X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;ds=sidebyside;f=emacs%2Fnotmuch-tree.el;h=f2938330b8877d35b9b61c1c708ca8077ab6986f;hb=785745783345d3ed56f0b435fcea44515aae8bea;hp=ef1ca4c552e5a98a079e81862241873e82cad53a;hpb=4f84c01b3ab2002812293a0951c4f69acb9ddea2;p=notmuch diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el index ef1ca4c5..f2938330 100644 --- a/emacs/notmuch-tree.el +++ b/emacs/notmuch-tree.el @@ -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)