summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Worth <cworth@cworth.org>2010-04-15 21:22:57 -0700
committerCarl Worth <cworth@cworth.org>2010-04-15 21:25:45 -0700
commitb4459b8a4d39f635f79d44f676be13e974cc1a72 (patch)
tree44d658f70273555267fd2b699fd18cb24c1c8dcc
parent75cfd0d90623373167d151c8556bd3359a054183 (diff)
emacs: Fix search filtering of a global search ("*")
With the recent addition of "*" being a special case for a search matching all messages, we have to take care when doing a filter operation. In this case it's not legal to simply append and get: * and <some-new-search-terms> Instead we carefully construct a new search string of only: <some-new-search-terms> This could all be avoided if we had a parser that could understand "*" with the meaning we want.
-rw-r--r--emacs/notmuch.el8
1 files changed, 6 insertions, 2 deletions
diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index be09f42..8b153cc 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -773,8 +773,12 @@ search."
Runs a new search matching only messages that match both the
current search results AND the additional query string provided."
(interactive "sFilter search: ")
- (let ((grouped-query (if (string-match-p notmuch-search-disjunctive-regexp query) (concat "( " query " )") query)))
- (notmuch-search (concat notmuch-search-query-string " and " grouped-query) notmuch-search-oldest-first)))
+ (let ((grouped-query (if (string-match-p notmuch-search-disjunctive-regexp query)
+ (concat "( " query " )")
+ query)))
+ (notmuch-search (if (string= notmuch-search-query-string "*")
+ grouped-query
+ (concat notmuch-search-query-string " and " grouped-query)) notmuch-search-oldest-first)))
(defun notmuch-search-filter-by-tag (tag)
"Filter the current search results based on a single tag.