After deleting or saving a message in pager view in the MUA mutt, the program remains in pager view and jumps to the next message in the current folder. Can this default behavior be changed so that after deleting or filing an email, the pager mode is exited and the folder index is displayed?

4 Answers 4


You want to execute two functions (delete-message and exit) at once so you have to use a macro:

macro pager d '<delete-message><exit>'

This will bind d to delete the current message and exit the pager.

You can do the same for s but it gets a little bit more complicated as you need to have user input, if you just accept the default save location or use save-hooks you can simply use

macro pager s '<save-message><enter><exit>'

If you want to alter the save location interactively I unfortunately don't have a tip how to change it, I'd try to use/leverage save-hooks

  • I was not able to determine if there was a configuration option for these actions, but binding to a macro definitely works well. Please let me know if you figure out how to do key bindings that involve user interaction. Thanks for your help.
    – user001
    Commented Jul 30, 2012 at 20:37
  • @user001 i don't know of such an option but you can have a look at mutt.org/doc/manual/manual-6.html which should cover all config options Commented Jul 30, 2012 at 20:41
  • Thanks -- I'm slowly making my way through the mutt documentation now.
    – user001
    Commented Jul 30, 2012 at 20:53
  • 2
    Hello. I notice that sometimes, by default, I am returned to the index after deleting a message in pager view. As a result, the <exit> command in the macro definition causes exiting from mutt to the terminal. Is there a way to simple jump to index so that this unintentional behavior can be avoided?
    – user001
    Commented Jul 31, 2012 at 2:05
  • 2
    @user001 if you are on the last message and delete a message mutt will automatically exit the pager. And no you can't create/test for things in a macro (as far as i know) Commented Jul 31, 2012 at 2:40

I solved it this way:

macro index d "s=Trash\n" "move message to trash"
macro pager d "C=Trash\n\n<exit><delete-message>" "move message to trash"

This also prevents to mark the next message as read


To make a macro for this that doesn't close mutt when you're on the last message you can do something like this:

macro pager d "<delete-message>i" "Delete message"

Or (if you're using Gmail)

macro pager e "<save-message>+archive<enter>i" "Archive message"

This way since i isn't mapped by default in the index, it will just tell you 'key not bound' rather than exiting mutt. But since in the pager it is the default mapping for exiting the pager it will work as expected.

Note that this does mark the next message as read if it was not already. You could probably add something to the end of that to fix that if you wanted to though.


I looked in the source code to figure this out.

macro pager d "<enter-command>unset resolve<enter><delete-message><enter-command>set resolve<enter><exit><next-entry>"

Of course modify this for what suits you. The key is turning "resolve" off prevents mutt from moving to the next message after you delete it.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .