]> git.notmuchmail.org Git - notmuch/commitdiff
emacs: new command notmuch-tree-filter
authorjao <jao@gnu.org>
Sun, 22 Aug 2021 00:50:48 +0000 (01:50 +0100)
committerDavid Bremner <david@tethera.net>
Sun, 22 Aug 2021 02:48:13 +0000 (19:48 -0700)
This command is analogous to notmuch-filter, but is defined on tree
mode buffers.

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

index f7df3040bc19dcda5b5ea1c5bda5a54591b32467..0ff4fdf56a433cabd2075bc646ed3156b8c113a1 100644 (file)
@@ -12,7 +12,7 @@
 | i         |                                        |                                                       |                                         |
 | j         | notmuch-jump-search                    | notmuch-jump-search                                   | notmuch-jump-search                     |
 | k         | notmuch-tag-jump                       | notmuch-tag-jump                                      | notmuch-tag-jump                        |
-| l         | notmuch-search-filter                  | notmuch-show-filter-thread                            |                                         |
+| l         | notmuch-search-filter                  | notmuch-show-filter-thread                            | notmuch-tree-filter                     |
 | m         | notmuch-mua-new-mail                   | notmuch-mua-new-mail                                  | notmuch-mua-new-mail                    |
 | n         | notmuch-search-next-thread             | notmuch-show-next-open-message                        | notmuch-tree-next-matching-message      |
 | o         | notmuch-search-toggle-order            |                                                       | notmuch-tree-toggle-order               |
index 952fe2a570063d6131d13726b0857d96cf0e459f..5accfa60dbbacbc25a3b48687de1e77abcb63d25 100644 (file)
@@ -302,6 +302,9 @@ tags.
 ``o`` ``notmuch-tree-toggle-order``
    |docstring::notmuch-tree-toggle-order|
 
+``l`` ``notmuch-tree-filter``
+   Filter or LIMIT the current search results based on an additional query string
+
 ``g`` ``=``
     Refresh the buffer
 
index ef1ca4c552e5a98a079e81862241873e82cad53a..f2938330b8877d35b9b61c1c708ca8077ab6986f 100644 (file)
@@ -349,6 +349,7 @@ then NAME behaves like CMD."
     (define-key map "r" 'notmuch-tree-reply-sender)
     (define-key map "R" 'notmuch-tree-reply)
     (define-key map "V" 'notmuch-tree-view-raw-message)
+    (define-key map "l" 'notmuch-tree-filter)
 
     ;; The main tree view bindings
     (define-key map (kbd "RET") 'notmuch-tree-show-message)
@@ -1168,6 +1169,21 @@ The arguments are:
   (interactive)
   (notmuch-tree query query-context target buffer-name open-target t))
 
+(defun notmuch-tree-filter (query)
+  "Filter or LIMIT the current search results based on an additional query string.
+
+Runs a new tree search matching only messages that match both the
+current search results AND the additional query string provided."
+  (interactive (list (notmuch-read-query "Filter search: ")))
+  (let ((notmuch-show-process-crypto (notmuch-tree--message-process-crypto))
+       (grouped-query (notmuch-group-disjunctive-query-string query))
+       (grouped-original-query (notmuch-group-disjunctive-query-string
+                                (notmuch-tree-get-query))))
+    (notmuch-tree-close-message-window)
+    (notmuch-tree (if (string= grouped-original-query "*")
+                     grouped-query
+                   (concat grouped-original-query " and " grouped-query)))))
+
 ;;; _
 
 (provide 'notmuch-tree)