On Jul 10, 2012 12:59 PM, "Sebastien Binet" <binet@cern.ch> wrote:
>
> Jani Nikula <jani@nikula.org> writes:
>
> > On Jul 9, 2012 8:12 PM, "Jameson Graef Rollins" <jrollins@finestructure.net>
> > wrote:
> >>
> >> On Mon, Jul 09 2012, Sebastien Binet <binet@cern.ch> wrote:
> >> > hum... is post-new supposed to be run even if there is no new message ?
> >>
> >> Hi, Sebastian.  Yes, I think it runs regardless if there are any new
> >> messages or not.
> >
> > That's correct; only errors in notmuch new cause post-new hook to be
> > skipped.
>
> ok. I thought using the post-new hook would have saved some i/o
> resources over my current setup:
>  offlineimap.postsynchook = ~/emacs/notmuch-lib/notmuch-tag.sh
>
> where notmuch-tag.sh is (in pseudo-code):
> ##
> /usr/bin/notmuch new
>
> for tag,query in tag-queries:
>   tag_new $tag $query
>
> ##
>
> is there any advantage of using post-new compared to this setup ?

There's no functional advantage. It does keep your initial tagging script connected with notmuch new rather than offlinemap, if you ever need to run notmuch new on its own.

If your tagging setup is really complicated, you could have some-tag in new.tags config, and bail out early if notmuch count tag:some-tag outputs 0 (and obviously notmuch tag -some-tag tag:some-tag later in the script). Just a thought.

J.

>
> -s