Quoth myself on Jan 08 at 8:49 pm: > > > @@ -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" For the record, here's a More Correct (TM) version "\\(^\\|[-+ ()]\\)\\(tag\\|is\\):\\(\"?\\)deleted\\3\\($\\|[ ()]\\)" However, as we discussed on IRC, it's probably better to fix this in the CLI/library by adding a config option for auto-excluded tags, an API to register these with the library (probably part of the query API), and to iterate over the terms in the parsed query to determine which tag exclusions should be automatically added.