[notmuch] [PATCH] Make search filters handle disjunctive queries.
keithp at keithp.com
Mon Nov 23 10:26:47 PST 2009
On Mon, 23 Nov 2009 19:07:23 +0100, Jed Brown <jed at 59A2.org> wrote:
> notmuch-search-filter accepts now accepts an arbitrary query and will
> group if necessary so that we get
> tag:inbox AND (gravy OR biscuits)
> notmuch-search-filter-tag now handles multiple terms. All terms in the
> query except AND and OR are interpreted as tags.
Remember to split patches which do more than one thing into separate
> + (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)))
Is there some reason not to just always add the parens?
> + (let ((tagged-query (replace-regexp-in-string notmuch-search-valid-term-regexp
> + (lambda (match) ; Prepend `tag:' to all except boolean operators
> + (if (string-match-p notmuch-search-boolean-operator-regexp match)
> + match (concat "tag:" match)))
> + query)))
This seems useful; how does it deal with the tag completion stuff?
keith.packard at intel.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 189 bytes
Desc: not available
More information about the notmuch