synchronizing the inbox flag

Antoine Beaupré anarcat at orangeseeds.org
Mon Apr 17 06:59:30 PDT 2017


Hi notmuchers! :)

I've done numerous attemps at making notmuch work across different
machines in the past. (See below for the details.) The only thing
missing now is the "inbox" tag synchronization. My use case is this: I
mostly use this one machine all the time. I have a [notmuch-tag][1]
script that sets a number of tags on messages depending on the folder
they're in and so on, so most tags are actually static and basically
shortcuts for saved searches.

Except the inbox tag: that tag is "floating" in the notmuch database and
is not sync'd on the server, which means when i pickup that laptop for
my next travel, i need to resync the whole notmuch database with notmuch
dump / restore. That is error-prone and annoying, and obviously fails
often because I don't regularly perform that sync.

What I would like to see in notmuch would be a way for the inbox tag to
be sync'd to the maildir storage. It could be an extra arbitrary flag in
the maildir filenames. From what I can tell from the [maildir
standard][2], there are 26 possible such such flags, with 6 formally
defined: P (passed), R (replied), S (seen, mapped as unread), F
(flagged), D (draft), T (trashed). The latter is not sync'd in notmuch,
the others are sync'd if synchronized_tags is true (default) in the
config file.

I would propose using the `A` or `I` flag, and sync it with the `inbox`
tag the same way the `S` flag is sync'd with the `unread` tag (ie. add
the flag when `inbox` is removed). Ideally, we could let the user
customize which flags are synchronized with which tags in the
configuration file. Given the limitations of the config file format
(ini-style), I'm not sure how that could be implemented.

Also note that certain IMAP servers treat non-standard flags as IMAP
keywords. [Dovecot][4], in particular, allows users to modify those
mappings by editing the `dovecot-keywords` file. In my local
configuration, where I have not manually edited that file, its contents
are:

    0 Junk
    1 NonJunk
    2 $Forwarded

This is presumably something that Thunderbird did at some point, or it
could be the default Dovecot configuration. So this may mean letters,
`A-C` are already taken, which means there could be interoperability
issues with using `A`: it could mean we tag all inbox messages as junk!
In this case, the `I` flag may be more appropriate (with a meaning the
opposite of `A`, ie. sync'd directly with the inbox tag).

Since there is a considerable range of foot-shooting potential here, it
may be better to just add an extra flag without allowing users to
customize the flags on their own. But I like the idea of allowing that
flexibility: it could fix a bunch of other use cases (like deleting mail
and syncing junk flags as well).

Anyone else working on this? Ideas of how this could be implemented?

Some more historical context follows...

My first attempt was a very old patch (2011!) to add resume
support in Notmuch - something that thankfully landed 6 years later:

    1310808075-787-1-git-send-email-anarcat at koumbit.org

My second attempt was the synchronization of the "deleted" tag to the T
(trashed) IMAP/maildir flag (~2012):

    1310874973-28437-1-git-send-email-anarcat at koumbit.org

That also failed and I ended up setting up a [script][3] to delete
messages tagged "deleted" automatically. The script also synchronizes
ham/spam flags.

Finally, I have also experimented with [muchsync][5] but that basically
failed for me: the thing would just run out of ram and fail to
synchronize tags.

[1]: https://gitlab.com/anarcat/scripts/blob/master/notmuch-tag
[2]: https://cr.yp.to/proto/maildir.html
[3]: https://gitlab.com/anarcat/scripts/blob/master/notmuch-purge
[4]: https://wiki2.dovecot.org/MailboxFormat/Maildir#IMAP_keywords
[5]: http://www.muchsync.org/

Thanks for any feedback!

-- 
Blind respect for authority is the greatest enemy of truth.
                       - Albert Einstein


More information about the notmuch mailing list