(emacs)Kbd Macro Query

Prev: Save Kbd Macro Up: Keyboard Macros

Executing Macros with Variations

   Using `C-x q' (`kbd-macro-query'), you can get an effect similar to
that of `query-replace', where the macro asks you each time around
whether to make a change.  When you are defining the macro, type `C-x
q' at the point where you want the query to occur.  During macro
definition, the `C-x q' does nothing, but when you run the macro later,
`C-x q' asks you interactively whether to continue.

   The valid responses when `C-x q' asks are SPC (or `y'), DEL (or
`n'), ESC (or `q'), `C-l' and `C-r'.  The answers are the same as in
query replace, though not all of the query-replace options are

   Specifically, SPC means to continue.  DEL means to skip the
remainder of this repetition of the macro and start right away with the
next repetition.  ESC means to skip the remainder of this repetition
and cancel further repetition.  `C-l' redraws the screen and asks you
again for a character to say what to do.

   `C-r' enters a recursive editing level, in which you can perform
editing which is not part of the macro.  When you exit the recursive
edit using `C-M-c', you are asked again how to continue with the
keyboard macro.  If you type a SPC at this time, the rest of the macro
definition is executed.  It is up to you to leave point and the text in
a state such that the rest of the macro will do what you want.

   `C-u C-x q', which is `C-x q' with a numeric argument, performs a
different function.  It enters a recursive edit reading input from the
keyboard, both when you type it during the definition of the macro, and
when it is executed from the macro.  During definition, the editing you
do inside the recursive edit does not become part of the macro.  During
macro execution, the recursive edit gives you a chance to do some
particularized editing.  Note: Recursive Edit.

automatically generated by info2www