* [PATCH] emacs: new command notmuch-tree-filter
@ 2021-07-31 22:28 jao
0 siblings, 0 replies; only message in thread
From: jao @ 2021-07-31 22:28 UTC (permalink / raw)
To: notmuch; +Cc: jao
This command is analogous to notmuch-filter, but is defined on tree
mode buffers.
---
doc/notmuch-emacs.rst | 3 +++
emacs/notmuch-tree.el | 19 +++++++++++++++++++
2 files changed, 22 insertions(+)
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..a18b47ff 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,24 @@ The arguments are:
(interactive)
(notmuch-tree query query-context target buffer-name open-target t))
+(eval-when-compile
+ (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 ((grouped-query (notmuch-group-disjunctive-query-string query))
+ (grouped-original-query (notmuch-group-disjunctive-query-string
+ (notmuch-tree-get-query))))
+ (notmuch-tree (if (string= grouped-original-query "*")
+ grouped-query
+ (concat grouped-original-query " and " grouped-query))))))
+
+(notmuch-tree--define-close-message-window-and
+ notmuch-tree-filter
+ notmuch-tree--filter)
+
;;; _
(provide 'notmuch-tree)
--
2.32.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2021-07-31 22:29 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-31 22:28 [PATCH] emacs: new command notmuch-tree-filter jao
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).