@c This is part of the Emacs manual.
-@c Copyright (C) 1985-1987, 1993-1995, 1997, 2000-2012
-@c Free Software Foundation, Inc.
+@c Copyright (C) 1985-1987, 1993-1995, 1997, 2000-2016 Free Software
+@c Foundation, Inc.
@c See file emacs.texi for copying conditions.
-@node Keyboard Macros, Files, Fixit, Top
+@node Keyboard Macros
@chapter Keyboard Macros
@cindex defining keyboard macros
@cindex keyboard macro
* Basic Keyboard Macro:: Defining and running keyboard macros.
* Keyboard Macro Ring:: Where previous keyboard macros are saved.
* Keyboard Macro Counter:: Inserting incrementing numbers in macros.
-* Keyboard Macro Query:: Making keyboard macros do different things each time.
-* Save Keyboard Macro:: Giving keyboard macros names; saving them in files.
+* Keyboard Macro Query:: Making keyboard macros do different things each
+ time.
+* Save Keyboard Macro:: Giving keyboard macros names; saving them in
+ files.
* Edit Keyboard Macro:: Editing keyboard macros.
* Keyboard Macro Step-Edit:: Interactively executing and editing a keyboard
macro.
@end example
@noindent
-will rotate the keyboard macro ring to the ``second previous'' macro,
+will rotate the keyboard macro ring to the second-previous macro,
execute the resulting head macro three times, rotate back to the
-original head macro, execute that once, rotate to the ``previous''
+original head macro, execute that once, rotate to the previous
macro, execute that, and finally delete it from the macro ring.
@findex kmacro-end-or-call-macro-repeat
desired macro is at the head of the ring. To execute the new macro
ring head immediately, just type @kbd{C-k}.
- Note that Emacs treats the head of the macro ring as the ``last
-defined keyboard macro.'' For instance, @key{F4} will execute that
+ Note that Emacs treats the head of the macro ring as the last
+defined keyboard macro. For instance, @key{F4} will execute that
macro, and @kbd{C-x C-k n} will give it a name.
@vindex kmacro-ring-max
@kindex C-x C-k C-e
@kindex C-x C-k RET
You can edit the last keyboard macro by typing @kbd{C-x C-k C-e} or
-@kbd{C-x C-k RET} (@code{kmacro-edit-macro}). This formats the macro
-definition in a buffer and enters a specialized major mode for editing
-it. Type @kbd{C-h m} once in that buffer to display details of how to
-edit the macro. When you are finished editing, type @kbd{C-c C-c}.
+@kbd{C-x C-k @key{RET}} (@code{kmacro-edit-macro}). This formats the
+macro definition in a buffer and enters a specialized major mode for
+editing it. Type @kbd{C-h m} once in that buffer to display details
+of how to edit the macro. When you are finished editing, type
+@kbd{C-c C-c}.
@findex edit-kbd-macro
@kindex C-x C-k e
@findex kmacro-step-edit-macro
@kindex C-x C-k SPC
You can interactively replay and edit the last keyboard
-macro, one command at a time, by typing @kbd{C-x C-k SPC}
+macro, one command at a time, by typing @kbd{C-x C-k @key{SPC}}
(@code{kmacro-step-edit-macro}). Unless you quit the macro using
@kbd{q} or @kbd{C-g}, the edited macro replaces the last macro on the
macro ring.
@itemize @bullet{}
@item
-@kbd{SPC} and @kbd{y} execute the current command, and advance to the
+@key{SPC} and @kbd{y} execute the current command, and advance to the
next command in the keyboard macro.
@item
-@kbd{n}, @kbd{d}, and @kbd{DEL} skip and delete the current command.
+@kbd{n}, @kbd{d}, and @key{DEL} skip and delete the current command.
@item
@kbd{f} skips the current command in this execution of the keyboard
macro, but doesn't delete it from the macro.
@item
-@kbd{@key{TAB}} executes the current command, as well as all similar
+@key{TAB} executes the current command, as well as all similar
commands immediately following the current command; for example, @key{TAB}
may be used to insert a sequence of characters (corresponding to a
sequence of @code{self-insert-command} commands).
@kbd{q} and @kbd{C-g} cancels the step-editing of the keyboard macro;
discarding any changes made to the keyboard macro.
@item
-@kbd{i KEY... C-j} reads and executes a series of key sequences (not
+@kbd{i @var{key}@dots{} C-j} reads and executes a series of key sequences (not
including the final @kbd{C-j}), and inserts them before the current
command in the keyboard macro, without advancing over the current
command.
@item
-@kbd{I KEY...} reads one key sequence, executes it, and inserts it
+@kbd{I @var{key}@dots{}} reads one key sequence, executes it, and inserts it
before the current command in the keyboard macro, without advancing
over the current command.
@item
-@kbd{r KEY... C-j} reads and executes a series of key sequences (not
+@kbd{r @var{key}@dots{} C-j} reads and executes a series of key sequences (not
including the final @kbd{C-j}), and replaces the current command in
the keyboard macro with them, advancing over the inserted key
sequences.
@item
-@kbd{R KEY...} reads one key sequence, executes it, and replaces the
+@kbd{R @var{key}@dots{}} reads one key sequence, executes it, and replaces the
current command in the keyboard macro with that key sequence,
advancing over the inserted key sequence.
@item
-@kbd{a KEY... C-j} executes the current command, then reads and
+@kbd{a @var{key}@dots{} C-j} executes the current command, then reads and
executes a series of key sequences (not including the final
@kbd{C-j}), and inserts them after the current command in the keyboard
macro; it then advances over the current command and the inserted key
sequences.
@item
-@kbd{A KEY... C-j} executes the rest of the commands in the keyboard
+@kbd{A @var{key}@dots{} C-j} executes the rest of the commands in the keyboard
macro, then reads and executes a series of key sequences (not
including the final @kbd{C-j}), and appends them at the end of the
keyboard macro; it then terminates the step-editing and replaces the