[PATCH v2 2/2] cli: add support for pre and post notmuch new hooks

Jani Nikula jani at nikula.org
Sun Dec 4 11:56:16 PST 2011


On Sun, 04 Dec 2011 11:46:38 -0500, Tom Prince <tom.prince at ualberta.net> wrote:
> On Sun,  4 Dec 2011 01:16:49 +0200, Jani Nikula <jani at nikula.org> wrote:
> > Run notmuch new pre and post hooks, named "pre-new" and "post-new", if
> > present in the notmuch hooks directory. The hooks will be run before and
> > after incorporating new messages to the database.
> > 
> > Typical use cases for pre-new and post-new hooks are fetching or delivering
> > new mail to the maildir, and custom tagging of the mail incorporated to the
> > database.
> > 
> > Also add command line option --no-hooks to notmuch new to bypass the
> > hooks.
> 
> A useful extension would be providing the list of added message-ids to the
> post-new hook, one per line? Or maybe the script wants added, moved,
> deleted ...

Hi Tom -

I have thought about passing arguments (or stdin) to the hooks, but IMHO
for now we're better off starting with plain hooks, gathering some
experience, and doing such extensions later on to get them right. It's
easier to add arguments than to change them.

I think it was you who told me of the idea of initial tagging with "new"
and then processing all those messages in a tagging script. I think this
approach is still very good and valid with hooks, and probably more
robust than message-id passing too (the hooks must be run before opening
and after closing the database, and the hooks might get
interrupted). Passing plenty of message-ids might be a bit heavy if they
end up not being used after all.

BR,
Jani.


More information about the notmuch mailing list