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.
I suspect mairix's symlinks have the same problem.
Unfortunately mairix isn't sufficient. It explicitly indexes certain header fields such as "To:", "From:", and "Subject:". Adding a new field is non-trivial.
(I looked at the code.)
nmzmail also failed. The indexer worked just fine, but changing this example from the README:
To this, which should have matched:
resulted in "0 messages found". I'm not sure if it is the indexer or matcher to blame there, but either way it failed.
As for symlinks? Well a hardlink is a type of symlink. As it happens I tried both ways:
Neither worked.
But for the moment I'm happy with my little patch. It doesnt work over IMAP, which is a shame, but otherwise it does everything I need. I even updated the sidebar patch at the same time.
If i am not wrong, that is what you are searching for.
Sorry anonymous but you are mistaken. That tool only allows a single folder to be tagged and searched.
If I use my hardlink solution to enable multi-folder tag searching the editlable script in that page doesn't allow the tag to be removed in the virtual folder - it edits a copy of the message.