Add support for specifying tags during "notmuch new"
David Edmondson
dme at dme.org
Fri May 2 08:32:50 PDT 2014
On Fri, May 02 2014, Austin Clements wrote:
>> 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 to:notmuch at notmuchmail.org
>> notmuch tag +gnus tag:$KEY and to:ding at gnus.org
>> ...
>> 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)?
It's a problem. I think that I would actually add both 'new' and
'new-$seconds' tags (given that I can't search on wildcarded tags) and
have 'notmuch tag' use only 'new-$seconds'.
The 'new' tag would help recover from failures such as you describe.
> 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.)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 310 bytes
Desc: not available
URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20140502/3ebea34c/attachment.pgp>
More information about the notmuch
mailing list