]> git.notmuchmail.org Git - notmuch/commitdiff
emacs: set query-context to nil if its "" or "*"
authorJani Nikula <jani@nikula.org>
Sun, 13 Aug 2017 09:07:24 +0000 (12:07 +0300)
committerDavid Bremner <david@tethera.net>
Sun, 20 Aug 2017 11:32:07 +0000 (08:32 -0300)
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
emacs/notmuch-tree.el

index 1cbcc132030a67c347938b943d70beb2fd67a59e..cd901e47193058429a842bd8b4260e9da18e8e0c 100644 (file)
@@ -1260,7 +1260,9 @@ matched."
     ;; aren't wiped out.
     (setq notmuch-show-thread-id thread-id
          notmuch-show-parent-buffer parent-buffer
     ;; 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.
 
          notmuch-show-process-crypto notmuch-crypto-process-mime
          ;; If `elide-toggle', invert the default value.
index 022525aec0f5d45c97dbb1079016fab58d1ab17d..220395e712bdf0bcdce56d38f78e91ece88f0970 100644 (file)
@@ -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)
   (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
   (setq notmuch-tree-target-msg target)
   (setq notmuch-tree-open-target open-target)
   ;; Set the default value for `notmuch-show-process-crypto' in this