]> git.cworth.org Git - notmuch/commitdiff
emacs: new command notmuch-tree-filter-by-tag
authorjao <jao@gnu.org>
Sun, 22 Aug 2021 00:50:49 +0000 (01:50 +0100)
committerDavid Bremner <david@tethera.net>
Sun, 22 Aug 2021 02:53:42 +0000 (19:53 -0700)
This new command for notmuch-tree-mode is analogous to
notmuch-search-filter-by-tag, bound to "t" in notmuch-search-mode; it
gets therefore the same "t" keybinding in notmuch-tree-mode (replacing
the current assignment to notmuch-search-by-tag).

devel/emacs-keybindings.org
doc/notmuch-emacs.rst
emacs/notmuch-tree.el

index 0ff4fdf56a433cabd2075bc646ed3156b8c113a1..2f73a1988051f55b9b8c432506673ae8774519b2 100644 (file)
@@ -20,7 +20,7 @@
 | q         | notmuch-bury-or-kill-this-buffer       | notmuch-bury-or-kill-this-buffer                      | notmuch-bury-or-kill-this-buffer        |
 | r         | notmuch-search-reply-to-thread-sender  | notmuch-show-reply-sender                             | notmuch-show-reply-sender               |
 | s         | notmuch-search                         | notmuch-search                                        | notmuch-search                          |
-| t         | notmuch-search-filter-by-tag           | toggle-truncate-lines                                 | notmuch-search-by-tag                   |
+| t         | notmuch-search-filter-by-tag           | toggle-truncate-lines                                 | notmuch-tree-filter-by-tag              |
 | u         |                                        |                                                       |                                         |
 | v         |                                        |                                                       | notmuch-show-view-all-mime-parts        |
 | w         |                                        | notmuch-show-save-attachments                         | notmuch-show-save-attachments           |
index 5accfa60dbbacbc25a3b48687de1e77abcb63d25..36dcb1162f10bd83fcb28d90022a0233142d2898 100644 (file)
@@ -305,6 +305,10 @@ tags.
 ``l`` ``notmuch-tree-filter``
    Filter or LIMIT the current search results based on an additional query string
 
+``t`` ``notmuch-tree-filter-by-tag``
+   Filter the current search results based on an additional tag
+
+
 ``g`` ``=``
     Refresh the buffer
 
index f2938330b8877d35b9b61c1c708ca8077ab6986f..01a77b716f3fa12c14317cc9dc790cd7301a6df7 100644 (file)
@@ -321,10 +321,10 @@ then NAME behaves like CMD."
     ;; These bindings shadow common bindings with variants
     ;; that additionally close the message window.
     (define-key map [remap notmuch-bury-or-kill-this-buffer] 'notmuch-tree-quit)
-    (define-key map [remap notmuch-search]       'notmuch-tree-to-search)
-    (define-key map [remap notmuch-help]         'notmuch-tree-help)
-    (define-key map [remap notmuch-mua-new-mail] 'notmuch-tree-new-mail)
-    (define-key map [remap notmuch-jump-search]  'notmuch-tree-jump-search)
+    (define-key map [remap notmuch-search]        'notmuch-tree-to-search)
+    (define-key map [remap notmuch-help]          'notmuch-tree-help)
+    (define-key map [remap notmuch-mua-new-mail]  'notmuch-tree-new-mail)
+    (define-key map [remap notmuch-jump-search]   'notmuch-tree-jump-search)
 
     (define-key map "o" 'notmuch-tree-toggle-order)
     (define-key map "S" 'notmuch-search-from-tree-current-query)
@@ -350,6 +350,7 @@ then NAME behaves like CMD."
     (define-key map "R" 'notmuch-tree-reply)
     (define-key map "V" 'notmuch-tree-view-raw-message)
     (define-key map "l" 'notmuch-tree-filter)
+    (define-key map "t" 'notmuch-tree-filter-by-tag)
 
     ;; The main tree view bindings
     (define-key map (kbd "RET") 'notmuch-tree-show-message)
@@ -1184,6 +1185,25 @@ current search results AND the additional query string provided."
                      grouped-query
                    (concat grouped-original-query " and " grouped-query)))))
 
+(defun notmuch-tree-filter-by-tag (tag)
+  "Filter the current search results based on a single TAG.
+
+Run a new search matching only messages that match the current
+search results and that are also tagged with the given TAG."
+  (interactive
+   (list (notmuch-select-tag-with-completion "Filter by tag: "
+                                            notmuch-tree-basic-query)))
+  (let ((notmuch-show-process-crypto (notmuch-tree--message-process-crypto)))
+    (notmuch-tree-close-message-window)
+    (notmuch-tree (concat notmuch-tree-basic-query " and tag:" tag)
+                 notmuch-tree-query-context
+                 nil
+                 nil
+                 nil
+                 notmuch-tree-unthreaded
+                 nil
+                 notmuch-search-oldest-first)))
+
 ;;; _
 
 (provide 'notmuch-tree)