* tagging moved messages
@ 2012-05-19 15:40 Emmanuel Beffara
0 siblings, 0 replies; only message in thread
From: Emmanuel Beffara @ 2012-05-19 15:40 UTC (permalink / raw)
To: notmuch
Hello,
What would be the proper way of automatically tagging messages whose
file has been renamed?
My use case is the following:
In order to have some synchronization of tags between several machines,
I use folders on the IMAP server. The idea is simply that messages
tagged "foo" are actually moved to a folder "foo". The same applies to
the "inbox" tag, and as an exception, messages in a folder named "saved"
are those with no tags. Of course this excludes having several tags on a
given message (except for the special tags like "unread" and "signed"),
but it does fit my needs for now. The post-new hook says this:
#!/bin/sh
for FOLDER in *
do
case $FOLDER in
INBOX) TAG=inbox ;;
Drafts) TAG=draft ;;
Trash) TAG=killed ;;
saved) continue ;;
*) TAG=$FOLDER
esac
notmuch tag -$TAG -- tag:$TAG not folder:$FOLDER
notmuch tag +$TAG -- folder:$FOLDER not tag:$TAG
done
It does work but it is rather slow: 8 seconds, for a collection of 16000
messages. I can live with that but it does involve browsing the whole
collection for each tag. Having a tag on all moved messages, like for
the new ones, would dramatically improve this process.
Besides, the "folder:" prefix is not an exact search, so the above does
not work well if one folder name is part of another, like if I had a
folder "bar" and a folder "foo.bar". Is there a way around this?
I have another script called "pre-sync" that moves messages to folders
according to their tags. This one is called before offlineimap does the
full actual synchronization (calling notmuch new after that).
I welcome any comments on my usage pattern, as there may well be better
approaches I didn't think of...
--
Emmanuel
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2012-05-19 15:49 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-19 15:40 tagging moved messages Emmanuel Beffara
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).