unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] emacs/tree: add notmuch-tree-filter
@ 2020-04-25 19:42 William Casarin
  2020-05-31 21:11 ` Tomi Ollila
  0 siblings, 1 reply; 3+ messages in thread
From: William Casarin @ 2020-04-25 19:42 UTC (permalink / raw)
  To: notmuch

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

Signed-off-by: William Casarin <jb55@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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-05-31 23:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-25 19:42 [PATCH] emacs/tree: add notmuch-tree-filter William Casarin
2020-05-31 21:11 ` Tomi Ollila
2020-05-31 22:54   ` William Casarin

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).