6

By default, Mutt wants to archive messages to folders by sender name. So when I hit s it prompts me with Save to mailbox ('?' for list): =sendername. I'd like to have it default to =INBOX.Archives.2015 instead.

I don't think I need a macro, which is how this one was solved: mutt: save message to specific folder

I just want to set a default so that the prompt is always =INBOX.Archives.2015 (I can reset it once a year, the year doesn't need to update.)

Amanda
  • 1,759
  • 2
  • 14
  • 26

2 Answers2

5

You need to add a line such as the following to your .muttrc:

save-hook . '=INBOX.Archives.2015'
wurtel
  • 16,115
  • I read the save-hook documentation three times and got the impression it would automatically move messages into the folder, without waiting until I save. – Amanda Nov 10 '15 at 22:54
  • mutt does nothing like that by itself, for that functionality you need procmail or something like that (I personally have exim as MTA and use its filtering features in my .forward file instead of procmail). – wurtel Nov 11 '15 at 07:51
  • So save-hook will just tweak the folder that Mutt suggests when I hit s? – Amanda Nov 13 '15 at 07:04
  • Yes. You can still modify it, of course. – wurtel Nov 13 '15 at 07:47
3

If you don't want to update your save-hook every year, you can also use %[%Y] to automatically expand the year. As described in the HTML mutt manual, it is possible to apply the same expandos as those used in the $index_format.

Hence the following:

save-hook . =INBOX.Archives.%[%Y]

would expand to the year (local time) that message was sent. Or if you want to default to the current year, irrespective of the date on the message itself, you would use:

save-hook . =INBOX.Archives.%<%Y>

You can expand this approach to any format supported by the strftime(3) function. So you could set of monthly archives with:

save-hook . =INBOX.Archives.%[%Y.%m]
Amanda
  • 1,759
  • 2
  • 14
  • 26
ovmjm
  • 141