[PATCH] emacs/tree: add notmuch-tree-filter

William Casarin jb55 at jb55.com
Sat Apr 25 12:42:34 PDT 2020


This implements the notmuch-tree version of notmuch-show-filter-thread
and binds it to the L key.

Signed-off-by: William Casarin <jb55 at jb55.com>
---
 emacs/notmuch-tree.el | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el
index e5c23de2..8f7738d7 100644
--- a/emacs/notmuch-tree.el
+++ b/emacs/notmuch-tree.el
@@ -328,6 +328,7 @@ FUNC."
     (define-key map "p" 'notmuch-tree-prev-matching-message)
     (define-key map "N" 'notmuch-tree-next-message)
     (define-key map "P" 'notmuch-tree-prev-message)
+    (define-key map "L" 'notmuch-tree-filter)
     (define-key map (kbd "M-p") 'notmuch-tree-prev-thread)
     (define-key map (kbd "M-n") 'notmuch-tree-next-thread)
     (define-key map "k" 'notmuch-tag-jump)
@@ -965,6 +966,14 @@ Complete list of currently available key bindings:
 		      (insert (format " (process returned %d)" exit-status)))
 		    (insert "\n")))))))))
 
+(defun notmuch-tree-filter (query)
+  "Filter or LIMIT the current tree based on a new query string.
+
+Reshows the current tree with matches defined by the new query-string."
+  (interactive (list (notmuch-read-query "Filter tree: ")))
+  (setq notmuch-tree-query-context (if (string= query "") nil query))
+  (notmuch-tree-refresh-view t))
+
 (defun notmuch-tree-process-filter (proc string)
   "Process and filter the output of \"notmuch show\" for tree view"
   (let ((results-buf (process-buffer proc))
-- 
2.25.1



More information about the notmuch mailing list