diff options
author | Jed Brown <jed@59A2.org> | 2009-12-02 12:00:35 +0100 |
---|---|---|
committer | Carl Worth <cworth@cworth.org> | 2009-12-04 11:11:59 -0800 |
commit | ea4cb3cbdc8b3c6e450b971f52e880223e943ba0 (patch) | |
tree | cc89bddf4e454947bca3b99a8e4a2081b86c8d8b /notmuch.el | |
parent | 95f97540a01cd7b4a3da5e2f27837956182869b2 (diff) |
Make search filters handle disjunctive queries.
notmuch-search-filter now accepts an arbitrary query and will group if
necessary so that we get
tag:inbox AND (gravy OR biscuits)
instead of the former
tag:inbox AND gravy OR biscuits
Signed-off-by: Jed Brown <jed@59A2.org>
Diffstat (limited to 'notmuch.el')
-rw-r--r-- | notmuch.el | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -1014,6 +1014,8 @@ thread from that buffer can be show when done with this one)." (defvar notmuch-search-oldest-first t "Show the oldest mail first in the search-mode") +(defvar notmuch-search-disjunctive-regexp "\\<[oO][rR]\\>") + (defun notmuch-search-scroll-up () "Move forward through search results by one window's worth." (interactive) @@ -1352,7 +1354,8 @@ search." Runs a new search matching only messages that match both the current search results AND the additional query string provided." (interactive "sFilter search: ") - (notmuch-search (concat notmuch-search-query-string " and " query) notmuch-search-oldest-first)) + (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))) (defun notmuch-search-filter-by-tag (tag) "Filter the current search results based on a single tag. |