Mutt is powerful because you can
combine atomic functions to build complex functionality. One such
combining is provided by macros. For those too lazy to reinvent the
wheel(s), let's collect some examples either for usefulness or
educational purposes. See also MuttGuide/Macros. Note: many macros for either "index" or "pager" mode are often
useful for the other mode, too, when they deal with a single selected
message. So keep in mind to define those for both modes to avoid to
wonder why something doesn't work where you expect it.
Change to a path prefix; complete and confirm with enter
macro index Aw <change-folder>imaps://email@example.com/
Pass HTML attachment to lynx
macro pager l "<pipe-entry>lynx -stdin -force_html<enter>" macro attach l "<pipe-entry>lynx -stdin -force_html<enter>"
"poor man's" trash-folder management
This does work with <tag-prefix> to apply for multiple, so seems a
pretty good substitute for the trash folder
folder-hook . 'macro index d "<save-message>=trash<enter>"' folder-hook =trash 'macro index d <delete-message>'
-- at least flaky if your inbox is not a Maildir; adjust "inbox" as
set maildir_trash=yesset wait_key=nofolder-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"'
if your trash folder-name has spaces in it
folder-hook . 'macro index d "<save-message>=Deleted<quote-char> Items<enter>"'
(be sure to modify spam destination, esc-d for spam, esc-u for unspam,
esc-t to test) See also `pipe_decode +
macro index \ed "<enter-command>unset wait_key\n<pipe-entry>sa-learn --spam\n<enter-command>set wait_key\n<save-message>=spam/evilspam\n" "Tags as SPAM"macro index \eu "<pipe-entry>sa-learn --ham\n<enter-command>set wait_key\n<save-message>=inbox\n" "Untags as SPAM"macro index \et "<pipe-entry>spamassassin -t\n<enter-command>set wait_key\n" "Tests if it is SPAM"