7.11 Repeating a Command
Many simple commands, such as those invoked with a single key or with M-x command-name RET
, can be repeated by invoking them with a numeric argument that serves as a repeat count (see Arguments). However, if the command you want to repeat prompts for input, or uses a numeric argument in another way, that method won’t work.
The command C-x z
(repeat
) provides another way to repeat an Emacs command many times. This command repeats the previous Emacs command, whatever that was. Repeating a command uses the same arguments that were used before; it does not read new arguments each time.
To repeat the command more than once, type additional z
’s: each z
repeats the command one more time. Repetition ends when you type a character other than z
or press a mouse button.
For example, suppose you type C-u 2 0 C-d
to delete 20 characters. You can repeat that command (including its argument) three additional times, to delete a total of 80 characters, by typing C-x z z z
. The first C-x z
repeats the command once, and each subsequent z
repeats it once again.