From: Kristoffer Balintona Date: Thu, 13 Nov 2025 20:39:14 +0000 (-0600) Subject: emacs: fix `notmuch-*-filter-by-tag' query strings X-Git-Url: https://git.notmuchmail.org/git?a=commitdiff_plain;h=07bb294049e786d1cf6fe07c6bef589826edb973;p=notmuch emacs: fix `notmuch-*-filter-by-tag' query strings `notmuch-tree-filter-by-tag' and `notmuch-search-filter-by-tag' are described, in their docstrings, as matching all the messages in the current view that are ALSO tagged by a given tag. However, since the current view's search query was not logically grouped together (with parentheses), the actual behavior was different for sufficiently complex search queries. Fix this by grouping the current view's search query in parentheses first. --- diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el index aa0d92a7..7c4b6d8f 100644 --- a/emacs/notmuch-tree.el +++ b/emacs/notmuch-tree.el @@ -1308,7 +1308,7 @@ search results and that are also tagged with the given TAG." notmuch-tree-basic-query))) (let ((notmuch-show-process-crypto (notmuch-tree--message-process-crypto))) (notmuch-tree-close-message-window) - (notmuch-tree (concat notmuch-tree-basic-query " and tag:" tag) + (notmuch-tree (format "(%s) and tag:%s" notmuch-tree-basic-query tag) notmuch-tree-query-context nil nil diff --git a/emacs/notmuch.el b/emacs/notmuch.el index 69aff347..c61c263d 100644 --- a/emacs/notmuch.el +++ b/emacs/notmuch.el @@ -1192,7 +1192,7 @@ search results and that are also tagged with the given TAG." (interactive (list (notmuch-select-tag-with-completion "Filter by tag: " notmuch-search-query-string))) - (notmuch-search (concat notmuch-search-query-string " and tag:" tag) + (notmuch-search (format "(%s) and tag:%s" notmuch-search-query-string tag) notmuch-search-oldest-first notmuch-search-hide-excluded))