Alternative to no longer supported folder:foo* wildcard matching ?

Jean-Marc Liotier jm at liotier.org
Tue Mar 10 05:21:38 PDT 2015


On 10/03/2015 08:10, David Bremner wrote:
> [..] In fact the NM_myTopLevelFolder doesn't seem useful to me,
> since you don't gain any new queries that way.
>
> So if you have .foo.*  and .bar.*, I would
>
> mkdir foo
> ln -rs .foo.* -t foo

I had forgotten I could make a maildir without initial . just as well - 
thus removing the need for my silly prefix: with dot is a normal 
maildir, without is a top-level Notmuch symlink container.

> in notmuch jargon, the number of _messages_ does not increase but 
> rather the number of _files_.

That makes sense since, from what I read in notmuch-insert.c,  the 
messages are identified by message-id and therefore counted only once 
however many times they are encountered during notmuch new.

> so --remove-dups becomes
> mandatory in any search query
> Based on the name, I'd suspect "remove-dups" corresponds roughly to the
> default behaviour of notmuch in reporting results.

Yes, though --duplicate=N is only supported with --output=files and 
--output=messages, and it is not even appear the default there since { 
NOTMUCH_OPT_INT, &ctx->dupe, "duplicate", 'D', 0  } in notmuch-search.c

Otherwise it does behaves as implicitly removing duplicates, which was 
somewhat confusing me until I understood notmuch's conceptual 
distinction between files and messages.

>          notmuch count not 'path:list/**'
> and
>          notmuch count not 'path:list/**' and from:bremner
>
> work as expected.

Indeed they do - both with notmuch and notmuch-mutt... I just had to 
struggle a bit until I realized that my notmuch-mutt --output-dir is 
inside the maildir indexed by notmuch... So the number of result and 
duplicates varied according to what state the symlink results maildir 
was in when I last indexed the whole thing...

Yes, I do need the --output-dir to be inside the maildir because the 
IMAP server lets me have my search results in any MUA I happen to be 
using (Thunderbird, K-9 or Outlook for example). And by the way, maybe 
notmuch-mutt should be named notmuch-maildir or notmuch-symlinks : the 
mutt part is just about setting the macros in ~/.muttrc - everything 
else is generic to anything that can read a maildir.

So my indexing command is now :

notmuch tag +nmsearchresult 'path:.=Search/**' && notmuch new

With ~/.notmuch-config now containing:

[search]
exclude_tags=deleted;spam;nmsearchresult

And it works.

I would have prefered explicit folder inclusion/exclusion at query time 
and path inclusion/exclusion at indexing time... But I guess I'll get 
used to notmuch's logic of tagging everything and then using the tags.

Thank you for your kind guidance !


More information about the notmuch mailing list