Gmail-label/Notmuch-tag sync script
es at ethanschoonover.com
Fri Feb 1 00:42:38 UTC 2013
I just cleaned up a script I've been using to do bidirectional sync between
notmuch tags and maildir folders. It's serious alpha level, and I'm not
sure if I want to keep doing this or switch to more of a "traditional" notmuch
setup with mutt-kz (due to the way mutt-kz handles tagging).
Regardless, I thought others might have interest in it. There are notes
on usage in the script (including how to dry-run with no changes).
Essentially, if you add a tag like "friends" and you have a "friends" maildir
then that message will be added to that maildir and thus will show up on gmail
tagged with "friends" as well.
Similarly, removing a tag (INBOX, "friends", any tag that matches a maildir)
will also remove the message from the actual maildir. This is how I am currently
archiving mail out of the INBOX, for instance.
Finally, if you manually move messages around in mutt (via the tradtional
folders), this script will update the notmuch tags to reflect those changes.
This includes moving/removing messages in maildirs.
This script currently uses the $ARCHIVE folder value ("All Mail", "archive") as
a key to indicate that mail has previously been scanned by this script. if you
already have a tag for your all mail / archive directory, either nuke your
notmuch db first or don't use this script in this form. (It's entirely easy
to modify this script to use an arbitrary "script-tag" to confirm that it's
correctly processed all messages at least once, but I've forgone that as I
didn't like to pollute my tag space).
Again, caution, there be dragons here, bears will eat your mail, etc. This
is more for reference as a working solution, but it really should see some
further testing if anyone wants to use it seriously.
http://ethanschoonover.com/solarized / es at ethanschoonover.com / @ethanschoonover
More information about the mutt-kz