Re: [PATCH 1/4] emacs: new customization variable to exclude "deleted" messages from search

Subject: Re: [PATCH 1/4] emacs: new customization variable to exclude "deleted" messages from search

Date: Sun, 8 Jan 2012 20:49:38 -0500

To: Aaron Ecay

Cc: Notmuch Mail

From: Austin Clements


> > @@ -927,6 +932,9 @@ The optional parameters are used as follows:
> >      (set 'notmuch-search-target-thread target-thread)
> >      (set 'notmuch-search-target-line target-line)
> >      (set 'notmuch-search-continuation continuation)
> > +    (when (and notmuch-search-exclude-deleted
> > +	       (not (string-match "tag:deleted[ )]*" query)))
> 
> “is:” is a synonym for “tag:” in searches – so this section of the code
> should look for it too.

There are several other things that could also trip up this regexp.
xtag:deletedx would be falsely matched, as would a quoted phrase
containing "tag:deleted", while tag:"deleted" and tag:(deleted) would
incorrectly not be matched.  Getting this right is hard, though I'd be
happy with

  "\\<\\(tag\\|is\\):deleted\\>"

or maybe

  "\\<\\(tag\\|is\\):\\(\"?\\)deleted\\>\\2"

Implicit exclusions like this were actually one of my target features
for the custom query parser, but I think hacking around that by
inspecting the query string is a fine interim solution.  (One of these
months I'll dust off the query parser, really!)

Thread: