Synchronising mail and notmuch tags between machines

Edward Betts edward at 4angle.com
Wed Nov 12 13:37:02 PST 2014


I've written some code to synchronise mail between my server and laptop. I
have notmuch running on both machine, whenever mail is added to notmuch, it is
tagged as needing to be copied to the other machine, the tags are
sync-to-laptop and sync-to-server. Whenever I modify the tags on a mail I'm
careful to add the sync tag. My mail reader is configured to add the sync tag
whenever I make any changes to a mail.

Here is the code:

https://github.com/EdwardBetts/notmuch-pushy/

The synchronise code opens each database and checks for messages that need to
be synchronised, the tags are copied to the other database, if the mail is new
then content is copied as well. Then the sync tag is removed from the source
message.

I'm using a Python RPC module called pushy, it provides a simple way to
connect two python interpreters on different machines. Pushy provides proxy
objects to access remote objects as if they are local. These means I can
access the local and remote notmuch databases from within the same piece of
code.  All the communication happens over ssh, and pushy even provides methods
for copying files between the machines.

https://pythonhosted.org/pushy/
https://github.com/pushyrpc/pushy

My main todo item is reducing the amount of time that the write lock is held.
I should copy messages back and forth before grabbing the write lock to update
the tags.

It would be helpful if the notmuch would always add the sync tag when a
message was modified, unless the sync tag is explicitly being removed. That
way there is no risk of me forgetting to add the sync tag when I'm modifying
tags using the command line tools.
-- 
Edward.


More information about the notmuch mailing list