Forcing a sync of maildir flags?

David Bremner david at
Thu Feb 20 04:22:42 PST 2020

Sean Whitton <spwhitton at> writes:

> I have this in my post-new hook:
>     notmuch tag -unread -- folder:sent
> The idea is that copies of my sent mail which get returned to me and
> stored in my inbox, e.g. by mailing lists, would get maildir Seen tags
> added to them.  But that does not happen.

I guess this is most likely a bug. It would be nice to have a test in that duplicated it. I suspect the problem is
related to messages in the new/ subdirectory. Some non-notmuch clients
(prominently mutt) interpret being in new/ has having user-visible
semantics, so notmuch tries not to move files out of there
unnecessarily, On the other hand the maildir spec says that files in
new/ cannot have flags, so they cannot have their unread tag removed
without moving the file to cur/

> This works:
>     notmuch tag +unread -- folder:sent
>     notmuch tag -unread -- folder:sent
> Is there some more elegant way to force a sync of maildir flags?  Am I
> the only one that has copies of my own mail in my inbox folder, not
> marked as read from the point of view of anything except notmuch?

I guess my workflow doesn't expose this problem as I leave many messages
unread (relying on the inbox flag). I'm not sure about the locking
implications, but having sent messages delivered to cur/ instead of to
new/ would probably workaround the problem.


More information about the notmuch mailing list