Mutt: macro for saving messages to a folder

mutt

This is an expansion on my previous question.

I have following macro, which will save tagged messages to my archive folder.

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"

and a second macro for doing the same action, but on the current message (not tagged):

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

Is there a way to combine these two macros into one? I.e., I would like a macro that does following action when I press S:

a) in case any messages are tagged, move all of them to `archive`
b) in case no messages are tagged, move current message to archive

Best Answer

With help from Michael Kjörling, here is the macro I was looking for:

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