Mutt Email Client – Save Message to Specific Folder

mutt

I have several folders defined in Mutt:

mailboxes           "~/Mail/inbox"
mailboxes           "~/Mail/sent"
mailboxes           "~/Mail/archive"

I can save (move) a message to archive, by pressing s and then ? to see a list of folders, and then I can choose archive from the list.

Since I always want only to save to archive I would like to have a macro, so that pressing s automatically saves selected message to archive, without asking me.

Can somebody please help?

EDIT:
I now have following macro, to save messages to my "archive" folder:

macro index,pager S "<tag-prefix><save-message>=archive<enter>\
  :set delete=yes<enter><sync-mailbox>:set delete=no<enter>"

the problem is, the messages stay in index marked as deleted. They are not "synced" immediately. Second, the <enter> at the end acts as <display-message>, so that when I press S, I end up in the pager of the current message.

In a similar way, I am trying to implement the trash folder in mutt. The following is taken from the Mutt MacroSamples

set maildir_trash=yes
set wait_key=no
folder-hook . 'bind index q quit'
folder-hook inbox 'macro index q ":unset maildir_trash;push \"T~D\\n<tag-prefix-cond>m=trash\\n<end-cond><quit>\"\n"'

but this does not work either. Insted mutt asks me:

Append messages to etmaildir_trash;push"T~D\n<tag-prefix-cond>m=trash\n<end-cond><quit>"/maildir_trash;push"T~D\n<tag-prefix-cond>m=trash\n<end-co ([yes]/no):

what ever I press, nothing happens
(the folders trash/{cur,new,tmp} do exist)

Best Answer

tagged mails:

macro index S ":set confirmappend=no delete=yes\n<tag-prefix-cond><save-message>=archive\n<sync-mailbox>:set confirmappend=yes delete=ask-yes\n"

current only:

macro index A ":set confirmappend=no delete=yes\n<save-message>=archive\n<sync-mailbox>:set confirmappend=yes delete=ask-yes\n"

edit

macro index S ":set confirmappend=no delete=yes\n<tag-prefix><save-message>=archive\n<sync-mailbox>:set confirmappend=yes delete=ask-yes\n"

My fault, using tag-prefix instead of tag-prefix-cond, will apply the macro to tagged messages if present, else to the current selected.

Related Question