[notmuch] [PATCH] Make search filters handle disjunctive queries.

Keith Packard 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
commits.

> +  (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
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20091123/59d04243/attachment.pgp>


More information about the notmuch mailing list