5

I've just called an interactive function (i.e., a command). I want to call it again, with the same arguments. I know that I can call a keyboard macro again by using e right after running it the first time. Is there something similar regarding interactive functions?

  • This must be a duplicate. This has been asked and answered before, I'm pretty sure... – Drew Jul 12 '16 at 1:00
5

There is also repeat-complex-command (normally bound to C-x ESC ESC as well as several others (that's the one I use, so I remember that)). This will go back further in the history to the last command that required interaction (i.e. prompted for input).

  • That's a great addition! This command is exactly what I was lacking in the previous answer. Wish I could accept both. – MatthewRock Jul 12 '16 at 8:21
  • 2
    @MatthewRock : if this one is closer to the solution you had in mind, feel free to unaccept the answer I posted and accept this one instead. – Dan Jul 12 '16 at 12:55
8

You are looking for repeat, bound by default to C-x z. The first part of the docstring:

(repeat REPEAT-ARG)

Repeat most recently executed command. If REPEAT-ARG is non-nil (interactively, with a prefix argument), supply a prefix argument to that command. Otherwise, give the command the same prefix argument it was given before, if any.

If you use evil, you also have access to the beloved dot command from Vim.

  • Nice! Too bad that it repeats any command - just repeated next-line... – MatthewRock Jul 12 '16 at 8:21
  • Will the site keep both answers? Someone doing a search and finding this question might actually be looking for either. They are both useful in their own way. – MAP Jul 13 '16 at 2:07
  • @MAP: yes, all answers will remain on the site, so it won't be a problem to move the acceptance to the other answer. – Dan Jul 13 '16 at 2:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.