unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: William Casarin <jb55@jb55.com>
To: notmuch@notmuchmail.org
Subject: [PATCH] emacs/tree: add notmuch-tree-filter
Date: Sat, 25 Apr 2020 12:42:34 -0700	[thread overview]
Message-ID: <20200425194234.17971-1-jb55@jb55.com> (raw)

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

             reply	other threads:[~2020-04-25 19:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-25 19:42 William Casarin [this message]
2020-05-31 21:11 ` [PATCH] emacs/tree: add notmuch-tree-filter Tomi Ollila
2020-05-31 22:54   ` William Casarin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200425194234.17971-1-jb55@jb55.com \
    --to=jb55@jb55.com \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).