Tagging strategy and latest notmuch

Austin Clements amdragon at MIT.EDU
Wed Dec 28 17:26:47 PST 2011


Quoth Xavier Maillard on Dec 28 at 11:46 pm:
> Hi,
> 
> my mail workflow is pretty /basic/ and /raw/. Here it is:
> 
> 1a. notmuch new (for consistency sake)
> 1b. notmuchsync syncs from notmuch tags to my maildir flags (actually, it is to
> prune is:delete tagged messages)

The synchronization of notmuch tags and maildir flags has been part of
notmuch for several releases now, so you don't need an external tool
to do that (unless you have some unusual configuration for it).  You
can delete is:delete messages reasonably easily from a script (perhaps
a tagging script or a cron job) using something like

  notmuch search --output=files is:delete | xargs rm

(untested, so don't take my word for it.)

> 2. offlineimap syncs with my imap server
> 3. notmuch new incorporate new messages into the database
> 4. notmuchsync syncs from my maildirs flags to notmuch
> 5. (at last) a shell-script is testing/tagging all my messages corpus

As of 0.11 (not 0.10.x, though), the right place to do initial tagging
is in the .notmuch/hooks/post-new script (there's obviously no harm in
doing it in a separate script, but if you do it in post-new, notmuch
will run the script for you).

> 
> This is a solution I am using for months but I am pretty sure it is not
> adapted with latest notmuch. Sadly I could not follow the recent feature
> additions (and reading through NEWS file or the wiki is not really
> helping).
> 
> So what I am looking for is a "modern" solution to replace my current
> strategy not really /scalable/ -i.e incorporating new mails is really
> getting slower each day- and most importantly I really need to reduce
> time taken to tag new material. Currently, my tagging script processes
> all my notmuch database even if only new mails are really tagged, it has
> to test each message to sort out what messages need tags; tagging only
> new mail would be really awesome.

Nothing has changed on this front to my knowledge, but a common
technique is to have notmuch tag all new mail with a "new" tag (using
the "tags" setting under the [new] configuration section), to use
tag:new in tagging operations that should only apply to newly
incorporated mail, and then to remove tag:new from everything at the
end of your tagging script.

One thing that may help a bit is that, as of 0.10, notmuch tag has
been optimized so, for example "notmuch tag -new '*'" is efficient.

> By the way, I am using 0.10.x.
> 
> Thank you
> 
> /Xavier


More information about the notmuch mailing list