Next: Save Keyboard Macro, Previous: Keyboard Macro Counter, Up: Keyboard Macros
In a keyboard macro, you can create an effect similar to that of
query-replace
, in that the macro asks you each time around
whether to make a change.
kbd-macro-query
).
While 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:
C-u C-x q, which is C-x q with a numeric argument, performs a completely 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 on each repetition. See Recursive Edit.