On 18 April 2011 16:26, Austin Clements <amdragon@mit.edu> wrote: > On Sun, Apr 17, 2011 at 2:23 PM, Jameson Graef Rollins > <jrollins@finestructure.net> wrote: >> By giving "notmuch new" a path to a message in the store: >> >> notmuch new /path/to/message >> >> By feeding "notmuch new" a message on stdin, and then having it write >> the message to a specified location: >> >> notmuch new /path/to/maildir <message >> >> You could then add the ability to add tags at the time of index: >> >> notmuch new +foo +bar /path/to/message I like more the idea of using a CLI option, e.g.: notmuch new --tag=foo --tag=bar /path/to/message > I think passing specific messages or directories to notmuch new would > enable some nice features; beyond immediate indexing any tagging of > sent mail, it could be combined with inotify to immediately index any > new mail I would add "efficiently", it can be done right now, but it would scan the whole mail sub-tree everytime. > However, concurrency and atomicity have to be considered carefully > with any proposal like this. For example, > notmuch new +foo +bar /path/to/message > has concurrency hazards: the caller has to store the message before > invoking notmuch new, but if the machine crashes between these two > operations, the message will be indexed with default tags on the next > notmuch new. Similarly, a chance unrelated invocation of notmuch new > immediately after the message is stored would result in the new > message being indexed with default tags. One solution to both issues would be to add the feature to "notmuch new" of taking the initial tags from a custom header (e.g.: X-Notmuchmail-Agent-Initial-Tags), and use message-ignored-mail-headers[1] to filter this header out the sent message. Servilio [1] http://www.gnu.org/software/emacs/manual/html_mono/message.html#Mail-Headers