From cb5253578d983471e5b55604581d390fcdda38f4 Mon Sep 17 00:00:00 2001 From: Jani Nikula Date: Sun, 13 Aug 2017 12:07:24 +0300 Subject: [PATCH] emacs: set query-context to nil if its "" or "*" The queries "" and "*" are special cased in the notmuch library to match all messages, but only if they're the entire query. They can't be combined with other queries, such as "* AND foo", in which case they "leak" down to the Xapian query parser. Notmuch show and tree buffers inadvertently combine the thread query with said special queries, causing incorrect collapsing of messages. Handle the special queries specially. We already do a similar thing in notmuch-search-filter. --- emacs/notmuch-show.el | 4 +++- emacs/notmuch-tree.el | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index 1cbcc132..cd901e47 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -1260,7 +1260,9 @@ matched." ;; aren't wiped out. (setq notmuch-show-thread-id thread-id notmuch-show-parent-buffer parent-buffer - notmuch-show-query-context query-context + notmuch-show-query-context (if (or (string= query-context "") + (string= query-context "*")) + nil query-context) notmuch-show-process-crypto notmuch-crypto-process-mime ;; If `elide-toggle', invert the default value. diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el index 022525ae..220395e7 100644 --- a/emacs/notmuch-tree.el +++ b/emacs/notmuch-tree.el @@ -897,7 +897,9 @@ the same as for the function notmuch-tree." (notmuch-tree-mode) (add-hook 'post-command-hook #'notmuch-tree-command-hook t t) (setq notmuch-tree-basic-query basic-query) - (setq notmuch-tree-query-context query-context) + (setq notmuch-tree-query-context (if (or (string= query-context "") + (string= query-context "*")) + nil query-context)) (setq notmuch-tree-target-msg target) (setq notmuch-tree-open-target open-target) ;; Set the default value for `notmuch-show-process-crypto' in this -- 2.43.0