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

Subject: Re: [notmuch] [PATCH] Make search filters handle disjunctive queries.

Date: Mon, 23 Nov 2009 10:26:47 -0800

To: Jed Brown, notmuch@notmuchmail.org, cworth@cworth.org

Cc:

From: Keith Packard


On Mon, 23 Nov 2009 19:07:23 +0100, Jed Brown <jed@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@intel.com
part-000.sig (application/pgp-signature)

Thread: