Hey,

I'm trying to emulate Thunderbird 3's mail archiving behaviour in mutt. In
Thunderbird if you select a mail or mails and hit the archive button or press
the 'a' key then it moves the mail(s) into an archive folder. For each account
it creates a folder called Archives with sub-folders for each year into which
the mails are moved: Archives/2010, Archives/2009, etc. Just hitting 'a' is
really quick and easy to do, and the automatic organisation means that your
folders don't get too big (currently with mutt I archive all mail into a single
huge ?mbox folder).

The first step was to set mutt's mbox variable according to the current year:

    set mbox="+Archives/`date +%Y`"

Now you can use the folder shortcut > for this year's archives folder.

The second step is a macro so that you can use 'A' (mutt already uses 'a' for
alias) to move a message to the mbox:

    # Bind 'A' to 'archive' an email (move it to ?mbox):
    macro index,pager A s><return>y "move message to ?mbox"

This macro works in either the index or the pager, and it works in combination
with mutt's tagging.

The one thing I would like the macro to do is to print out some sort of
confirmation message to the user, such as

    "Moved N message(s) to +Archives/2010"

because currently archiving a mail looks exactly like deleting it, which is
quite disconcerting. I couldn't find a mutt function for this though.

Also, I realised that if the year is 2010 when you archive a mail then it will
go into Archives/2010, even though (if the mail has been hanging around in your
inbox) you might have actually received the mail in 2009. A better macro might
move each mail into a different archive folder depending on the date of the
mail. Although in that case I worry about the possibility of receiving an email
in 2010 with an incorrect date header, stating 1977 to 2017 or something, maybe
I'm just paranoid.

Reply via email to