Re: Add support for specifying tags during "notmuch new"

Subject:Re: Add support for specifying tags during "notmuch new"

Date:Fri, 2 May 2014 11:18:01 -0400

To:David Edmondson

From:Austin Clements

Quoth David Edmondson on May 02 at  9:15 am:
> This patch set allows a user to specify a list of tags to be
> added/removed to messages discovered during "notmuch new".
> Two use-cases are envisaged:
>     1) A chunk of messages was just dumped into the configured
>        directory by hand, and the user doesn't want the 'inbox' tag
>        applied to them. Run 'notmuch new -inbox'.
>     2) A periodic mail processing script wants to add new messages to
>        the database, then process those newly added messages to add
>        convenience tags, etc. without worrying about the user or other
>        instances of the script manipulating tags at the same time. Use
>        this approach:
>          KEY=$RANDOM
> 	 notmuch new +$KEY
> 	 notmuch tag +notmuch tag:$KEY and
> 	 notmuch tag +gnus tag:$KEY and
> 	 ...
> 	 notmuch tag -$KEY tag:$KEY

What happens when this script dies in the middle (say, your computer
loses power or notmuch tag conflicts with something else on the write
lock)?  One advantage of the standard "new" tag approach is that it's
easy to write a stateless post-new tagging script that can be killed
at any point and restarted.  (You're right that post-new has a
concurrency issue, but we should fix that in its own right.)