Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I created a macro in mutt to send the selected message to my archive folder:

macro index,pager ,m s=Archive

In many cases, new messages are archived right away, so I tried to extend the macro:

macro index,pager ,m Wnks=Archive

This works fine unless the last message is selected. In this case, the target message remains selected after clearing the N/O flag, and the k command moves the selection to the previous message in the list. Is there any way to apply multiple commands to a certain message, without having to resort to movement commands?

share|improve this question
up vote 2 down vote accepted

Mutt normally advances the cursor to the next message whenever a command that modifies the current message is executed. This behavior is controlled by the 'resolve' configuration variable. So, one solution would be to extend your macro to unset resolve before executing the other commands, then re-set it afterwards.

macro index,pager ,m ": unset resolve\nWnks=Archive\n: set resolve\n"

Note that that is untested. I put it together from your macro plus some macros in my muttrc in which I unset/set various configuration variables before/after executing the core of the macros. Also note the space after each colon. This prevents the following command from being saving in the command-line history. This is not important but can be convenient to avoid clutter in your history.

share|improve this answer
Excellent, I removed the "k" from your above solution (it is not required if the message focus does not change). Thanks! – janeden Jun 6 '11 at 16:49

You must log in to answer this question.

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