From: jao <jao@gnu.org>
To: notmuch@notmuchmail.org
Cc: jao <jao@gnu.org>
Subject: [PATCH v4 1/2] emacs: new command notmuch-tree-filter
Date: Sun, 22 Aug 2021 01:50:48 +0100 [thread overview]
Message-ID: <20210822005049.643219-1-jao@gnu.org> (raw)
This command is analogous to notmuch-filter, but is defined on tree
mode buffers.
---
devel/emacs-keybindings.org | 2 +-
doc/notmuch-emacs.rst | 3 +++
emacs/notmuch-tree.el | 16 ++++++++++++++++
3 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/devel/emacs-keybindings.org b/devel/emacs-keybindings.org
index f7df3040..0ff4fdf5 100644
--- a/devel/emacs-keybindings.org
+++ b/devel/emacs-keybindings.org
@@ -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 |
diff --git a/doc/notmuch-emacs.rst b/doc/notmuch-emacs.rst
index 952fe2a5..5accfa60 100644
--- a/doc/notmuch-emacs.rst
+++ b/doc/notmuch-emacs.rst
@@ -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
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)
--
2.33.0
next reply other threads:[~2021-08-22 0:51 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-22 0:50 jao [this message]
2021-08-22 0:50 ` [PATCH v4 2/2] emacs: new command notmuch-tree-filter-by-tag jao
2021-08-22 3:23 ` [PATCH v4 1/2] emacs: new command notmuch-tree-filter David Bremner
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=20210822005049.643219-1-jao@gnu.org \
--to=jao@gnu.org \
--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).