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 Numeric 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.
Also you can activate repeat-mode that temporarily enables a
transient mode with short keys after a limited number of commands.
Currently supported shorter key sequences are C-x u u instead of
C-x u C-x u to undo many changes, C-x o o instead of
C-x o C-x o to switch several windows, C-x { { } } ^ ^ v v to resize the selected window interactively, M-g n n p p to
navigate next-error matches, and C-x ] ] [ [ to navigate
through pages. Any other key exits transient mode and then is
executed normally. The user option repeat-exit-key defines an
additional key to exit this transient mode. Also it’s possible to
break the repetition chain automatically after some idle time by
customizing the user option repeat-exit-timeout to specify the
idle time in seconds after which this transient mode will be turned
off.