So, as I previously mentioned I want to be able to tag messages in Mutt.
There exist folder-based solutions already, using the X-Label header. There doesn't appear to be any existing solution allowing you to view all messages with a given tag across mailboxes.
So I wrote a simple shell script to create virtual mailboxes, such as ~/Maildir/tags-debian for all messages with a debian tag, using hardlinks.
My conclusion is that this solution will not work properly in practise, primarily because of deficiencies in mutt.
The simple case works just fine. I add a tag to a message, and later when the indexing job runs the virtual folder is created. I can open it and work on it just fine.
So where's the problem? Well in my case I tend to tag messages with a label such as "todo". Once I've done whatever I was supposed to I can remove the tag.
Using this hardlinking scheme I cannot remove the tag(s) in the virtual folder - I have to remove it in the original message which is a real pain.
Why? Well quite simply mutt will not let me work on my virtual message without destroying the hardlink.. If I use the edit function, for example, I am presented with a copy of the mail for editing - and the hardlink is replaced when that copy is saved.
Even the edit-label patch which allows you to edit the X-Label header from within mutt ends up replacing the hardlink with a new file!
So whats the solution? Well I guess I want to be able to run an external command against a message in mutt - passing the filename of the Maildir message as an argument. That way I can edit the live file.
Right now I don't believe that is possible, but I'd love to be told different.
If anybody has any solutions of editing, or even just deleting, a header from a message within mutt - in such a way that the hardlink isn't destroyed please do let me know.
Simple reproducer:
mkdir -p ~/Maildir/.foo/cur mkdir ~/Maildir/.foo/new mkdir ~/Maildir/.foo/tmp cp 'validmessage' ~/Maildir/ ln validmessage ~/Maildir/.foo/cur
Now edit the message - start mutt open the message in the index and press 'e' - the hardlink is now gone. Replaced by a new file with the contents, so the original mail message is unchanged.
Update: I've got an "edit-inplace" primitive working, via the very hacky header-fu patch. It is not complete, but it demonstrates that it can be done. My world is now complete.
Tags: mutt, rants, tags 7 comments
I suspect mairix's symlinks have the same problem.