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

Jameson Graef Rollins jrollins at finestructure.net
Sun Jan 8 18:34:31 PST 2012


On Sun, 8 Jan 2012 20:49:38 -0500, Austin Clements <amdragon at MIT.EDU> wrote:
> > > @@ -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.

Thanks so much for the review, guys.  I should have mentioned in this
patch that the my regex skills are very weak, and that it was surely
incomplete.  I always forget about the is: prefix as well.

> Getting this right is hard, though I'd be happy with
> 
>   "\\<\\(tag\\|is\\):deleted\\>"

Every time I think I start to understand regex I am reminded that it's
black magic and I really know nothing.  For instance, I am not familiar
with "<" or ">", although they appear to be a "word" boundaries
(although I'm not sure how "word" is defined).  Also, why is all the \\
(double?)  escaping needed?  I'll certainly take your word for it,
though.

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

After staring at this for 10 minutes I think I'm getting the extra bits
here.  It matches an initial \", and then a second at the end if the
first matched.  That's clever.  Why 

  \\>\\2

instead of

 \\2\\>

?

I'm definitely confused by why so much apparent escaping is needed,
though.

> 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!)

Very much looking forward to it!

jamie.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20120108/3afe3c7f/attachment-0001.pgp>


More information about the notmuch mailing list