Hi Vladimir,
On Mon, May 13, 2013 at 10:36:07AM +0200, Vladimir Marek wrote:
Hi,
Since I'm usually using several mail clients (from phone, old mutt, mutt-kz) it happens quite often that mutt complains.
rename: No such file or directory (errno = 2)
and the only thing I can do about it is to kill whole mutt. What I believe is happening is that if I view unread mail, mutt remembers that it has to move the mail once it leaves current inbox. But before that, someone else touches the mail (probably moving the message from 'new' directory to 'cur'. After that mutt-kz can't find the original file and complains with the error message.
I think this is a problem with mutt-kz not syncing the notmuch database as it updates the maildir flags for the email. I have noticed this while using emacs-notmuch, notmuch cli, and mutt-kz.
Now consider the following scenario. Mutt sees new mail in a maildir, then you read it. Now until the next notmuch sync (say with `notmuch new' from a cron job or OfflineIMAP hook) notmuch thinks the file is <maildir>/new/<some_name>,N. Whereas mutt has renamed it to <maildir>/cur/<some_name>,S! This can happen everytime mutt updates a maildir flag (IOW renames a message file). IMO, this is an inherrent issue with the maildir format. So you will see this out-of-sync behaviour when mutt flags an email as "old", read, or adds the replied flag.
I find this behaviour quite inconvenient at times and planned to take a look at it. But then both lack of time, and lack of understanding of mutt internals have been in the way :-p.
This seems to be problem in the mutt maildir handling rather than in the notmuch addon, still I wonder if you saw that or even better have some plans on tackling that :)
I thought one possible solution might be introducing a hook to what ever function that does the file renaming when maildir flags are updated. I'm not sure how one can introduce a hook though. Another option would be to add a inotify watch on the maildir currently mutt is viewing. And follow-up on any inotify events.
Hopefully I understood your question correctly and my comments make sense to you.
Cheers,
:)