(Expanding Abbrevs): Fix previous fix.
[emacs.git] / man / kmacro.texi
blob459752d3c4b6ed807bbbdd0ff998eb4a4ae2dc0b
1 @c This is part of the Emacs manual.
2 @c Copyright (C) 1985,86,87,93,94,95,97,2000,2001,2002,2003,2004
3 @c  Free Software Foundation, Inc.
4 @c See file emacs.texi for copying conditions.
5 @node Keyboard Macros, Files, Fixit, Top
6 @chapter Keyboard Macros
7 @cindex defining keyboard macros
8 @cindex keyboard macro
10   In this chapter we describe how a sequence of editing commands can
11 be recorded and repeated multiple times.
13   A @dfn{keyboard macro} is a command defined by the user to stand for
14 another sequence of keys.  For example, if you discover that you are
15 about to type @kbd{C-n C-d} forty times, you can speed your work by
16 defining a keyboard macro to do @kbd{C-n C-d} and calling it with a
17 repeat count of forty.
19   You define a keyboard macro while executing the commands which are the
20 definition.  Put differently, as you define a keyboard macro, the
21 definition is being executed for the first time.  This way, you can see
22 what the effects of your commands are, so that you don't have to figure
23 them out in your head.  When you are finished, the keyboard macro is
24 defined and also has been, in effect, executed once.  You can then do the
25 whole thing over again by invoking the macro.
27   Keyboard macros differ from ordinary Emacs commands in that they are
28 written in the Emacs command language rather than in Lisp.  This makes it
29 easier for the novice to write them, and makes them more convenient as
30 temporary hacks.  However, the Emacs command language is not powerful
31 enough as a programming language to be useful for writing anything
32 intelligent or general.  For such things, Lisp must be used.
34 @menu
35 * Basic Keyboard Macro::     Defining and running keyboard macros.
36 * Keyboard Macro Ring::      Where previous keyboard macros are saved.
37 * Keyboard Macro Counter::   Inserting incrementing numbers in macros.
38 * Keyboard Macro Query::     Making keyboard macros do different things each time.
39 * Save Keyboard Macro::      Giving keyboard macros names; saving them in files.
40 * Edit Keyboard Macro::      Editing keyboard macros.
41 * Keyboard Macro Step-Edit::   Interactively executing and editing a keyboard macro.
42 @end menu
44 @node Basic Keyboard Macro
45 @section Basic Use
47 @table @kbd
48 @item C-x (
49 Start defining a keyboard macro (@code{kmacro-start-macro}).
50 @item C-x )
51 End the definition of a keyboard macro (@code{kmacro-end-macro}).
52 @item C-x e
53 Execute the most recent keyboard macro (@code{kmacro-end-and-call-macro}).
54 First end the definition of the keyboard macro, if currently defining it.
55 To immediately execute the keyboard macro again, just repeat the @kbd{e}.
56 @item C-u C-x (
57 Re-execute last keyboard macro, then add more keys to its definition.
58 @item C-u C-u C-x (
59 Add more keys to the last keyboard macro without re-executing it.
60 @item C-x q
61 When this point is reached during macro execution, ask for confirmation
62 (@code{kbd-macro-query}).
63 @item C-x C-k n
64 Give a command name (for the duration of the session) to the most
65 recently defined keyboard macro (@code{kmacro-name-last-macro}).
66 @item C-x C-k b
67 Bind the most recently defined keyboard macro to a key sequence (for
68 the duration of the session) (@code{kmacro-bind-to-key}).
69 @item M-x insert-kbd-macro
70 Insert in the buffer a keyboard macro's definition, as Lisp code.
71 @item C-x C-k e
72 Edit a previously defined keyboard macro (@code{edit-kbd-macro}).
73 @item C-x C-k r
74 Run the last keyboard macro on each line that begins in the region
75 (@code{apply-macro-to-region-lines}).
76 @end table
78 @kindex C-x (
79 @kindex C-x )
80 @kindex C-x e
81 @findex kmacro-start-macro
82 @findex kmacro-end-macro
83 @findex kmacro-end-and-call-macro
84   To start defining a keyboard macro, type the @kbd{C-x (} command
85 (@code{kmacro-start-macro}).  From then on, your keys continue to be
86 executed, but also become part of the definition of the macro.  @samp{Def}
87 appears in the mode line to remind you of what is going on.  When you are
88 finished, the @kbd{C-x )} command (@code{kmacro-end-macro}) terminates the
89 definition (without becoming part of it!).  For example,
91 @example
92 C-x ( M-f foo C-x )
93 @end example
95 @noindent
96 defines a macro to move forward a word and then insert @samp{foo}.
98   The macro thus defined can be invoked again with the @kbd{C-x e}
99 command (@code{kmacro-end-and-call-macro}), which may be given a
100 repeat count as a numeric argument to execute the macro many times.
101 If you enter @kbd{C-x e} while defining a macro, the macro is
102 terminated and executed immediately.
104   After executing the macro with @kbd{C-x e}, you can use @kbd{e}
105 repeatedly to immediately repeat the macro one or more times.  For example,
107 @example
108 C-x ( xyz C-x e e e
109 @end example
111 @noindent
112 inserts @samp{xyzxyzxyzxyz} in the current buffer.
114   @kbd{C-x )} can also be given a repeat count as an argument, in
115 which case it repeats the macro that many times right after defining
116 it, but defining the macro counts as the first repetition (since it is
117 executed as you define it).  Therefore, giving @kbd{C-x )} an argument
118 of 4 executes the macro immediately 3 additional times.  An argument
119 of zero to @kbd{C-x e} or @kbd{C-x )} means repeat the macro
120 indefinitely (until it gets an error or you type @kbd{C-g} or, on
121 MS-DOS, @kbd{C-@key{BREAK}}).
123   If you wish to repeat an operation at regularly spaced places in the
124 text, define a macro and include as part of the macro the commands to move
125 to the next place you want to use it.  For example, if you want to change
126 each line, you should position point at the start of a line, and define a
127 macro to change that line and leave point at the start of the next line.
128 Then repeating the macro will operate on successive lines.
130   When a command reads an argument with the minibuffer, your
131 minibuffer input becomes part of the macro along with the command.  So
132 when you replay the macro, the command gets the same argument as
133 when you entered the macro.  For example,
135 @example
136 C-x ( C-a C-@key{SPC} C-n M-w C-x b f o o @key{RET} C-y C-x b @key{RET} C-x )
137 @end example
139 @noindent
140 defines a macro that copies the current line into the buffer
141 @samp{foo}, then returns to the original buffer.
143   You can use function keys in a keyboard macro, just like keyboard
144 keys.  You can even use mouse events, but be careful about that: when
145 the macro replays the mouse event, it uses the original mouse position
146 of that event, the position that the mouse had while you were defining
147 the macro.  The effect of this may be hard to predict.  (Using the
148 current mouse position would be even less predictable.)
150   One thing that doesn't always work well in a keyboard macro is the
151 command @kbd{C-M-c} (@code{exit-recursive-edit}).  When this command
152 exits a recursive edit that started within the macro, it works as you'd
153 expect.  But if it exits a recursive edit that started before you
154 invoked the keyboard macro, it also necessarily exits the keyboard macro
155 as part of the process.
157   After you have terminated the definition of a keyboard macro, you can add
158 to the end of its definition by typing @kbd{C-u C-x (}.  This is equivalent
159 to plain @kbd{C-x (} followed by retyping the whole definition so far.  As
160 a consequence it re-executes the macro as previously defined.
162   You can also add to the end of the definition of the last keyboard
163 macro without re-executing it by typing @kbd{C-u C-u C-x (}.
165   The variable @code{kmacro-execute-before-append} specifies whether
166 a single @kbd{C-u} prefix causes the existing macro to be re-executed
167 before appending to it.
169 @findex apply-macro-to-region-lines
170 @kindex C-x C-k r
171   The command @kbd{C-x C-k r} (@code{apply-macro-to-region-lines})
172 repeats the last defined keyboard macro on each line that begins in
173 the region.  It does this line by line, by moving point to the
174 beginning of the line and then executing the macro.
176 @node Keyboard Macro Ring
177 @section The Keyboard Macro Ring
179   All defined keyboard macros are recorded in the ``keyboard macro ring'',
180 a list of sequences of keys.  There is only one keyboard macro ring,
181 shared by all buffers.
183   All commands which operate on the keyboard macro ring use the
184 same @kbd{C-x C-k} prefix.  Most of these commands can be executed and
185 repeated immediately after each other without repeating the @kbd{C-x
186 C-k} prefix.  For example,
188 @example
189 C-x C-k C-p C-p C-k C-k C-k C-n C-n C-k C-p C-k C-d
190 @end example
192 @noindent
193 will rotate the keyboard macro ring to the ``second previous'' macro,
194 execute the resulting head macro three times, rotate back to the
195 original head macro, execute that once, rotate to the ``previous''
196 macro, execute that, and finally delete it from the macro ring.
198 @findex kmacro-end-or-call-macro-repeat
199 @kindex C-x C-k C-k
200   The command @kbd{C-x C-k C-k} (@code{kmacro-end-or-call-macro-repeat})
201 executes the keyboard macro at the head of the macro ring.  You can
202 repeat the macro immediately by typing another @kbd{C-k}, or you can
203 rotate the macro ring immediately by typing @kbd{C-n} or @kbd{C-p}.
205 When a keyboard macro is being defined, @kbd{C-x C-k C-k} behaves like
206 @kbd{C-x )} except that, immediately afterward, you can use most key
207 bindings of this section without the @kbd{C-x C-k} prefix.  For
208 instance, another @kbd{C-k} will re-execute the macro.
210 @findex kmacro-cycle-ring-next
211 @kindex C-x C-k C-n
212 @findex kmacro-cycle-ring-previous
213 @kindex C-x C-k C-p
214   The commands @kbd{C-x C-k C-n} (@code{kmacro-cycle-ring-next}) and
215 @kbd{C-x C-k C-p} (@code{kmacro-cycle-ring-previous}) rotate the
216 macro ring, bringing the next or previous keyboard macro to the head
217 of the macro ring.  The definition of the new head macro is displayed
218 in the echo area.  You can continue to rotate the macro ring
219 immediately by repeating just @kbd{C-n} and @kbd{C-p} until the
220 desired macro is at the head of the ring.  To execute the new macro
221 ring head immediately, just type @kbd{C-k}.
223   Note that Emacs treats the head of the macro ring as the ``last
224 defined keyboard macro''.  For instance, it is the keyboard macro that
225 @kbd{C-x e} will execute.
227 @findex kmacro-view-macro-repeat
228 @kindex C-x C-k C-v
230   The command @kbd{C-x C-k C-v} (@code{kmacro-view-macro-repeat})
231 displays the last keyboard macro, or when repeated (with @kbd{C-v}),
232 it displays the previous macro on the macro ring, just like @kbd{C-x
233 C-k C-p}, but without actually rotating the macro ring.  If you enter
234 @kbd{C-k} immediately after displaying a macro from the ring, that
235 macro is executed, but still without altering the macro ring.
237   So while e.g. @kbd{C-x C-k C-p C-p C-p C-k C-k} makes the 3rd previous
238 macro the current macro and executes it twice, @kbd{C-x C-k C-v C-v
239 C-v C-k C-k} will display and execute the 3rd previous macro once and
240 then the current macro once.
242 @findex kmacro-delete-ring-head
243 @kindex C-x C-k C-d
245   The command @kbd{C-x C-k C-d} (@code{kmacro-delete-ring-head})
246 removes and deletes the macro currently at the head of the macro
247 ring.  You can use this to delete a macro that didn't work as
248 expected, or which you don't need anymore.
250 @findex kmacro-swap-ring
251 @kindex C-x C-k C-t
253   The command @kbd{C-x C-k C-t} (@code{kmacro-swap-ring})
254 interchanges the head of the macro ring with the previous element on
255 the macro ring.
257 @findex kmacro-call-ring-2nd-repeat
258 @kindex C-x C-k C-l
260   The command @kbd{C-x C-k C-l} (@code{kmacro-call-ring-2nd-repeat})
261 executes the previous (rather than the head) element on the macro ring.
263 @vindex kmacro-ring-max
264   The maximum number of macros stored in the keyboard macro ring is
265 determined by the customizable variable @code{kmacro-ring-max}.
267 @node Keyboard Macro Counter
268 @section The Keyboard Macro Counter
270   Each keyboard macro has an associated counter.  Normally, the
271 macro counter is initialized to 0 when you start defining the macro,
272 and incremented by 1 after each insertion of the counter value;
273 that is, if you insert the macro counter twice while defining the
274 macro, the counter will increase by 2 on each repetition of the macro.
276 @findex kmacro-insert-counter
277 @kindex C-x C-k C-i
278   The command @kbd{C-x C-k C-i} (@code{kmacro-insert-counter}) inserts
279 the current value of the keyboard macro counter and increments the
280 counter by 1.  You can use a numeric prefix argument to specify a
281 different increment.  If you just specify a @kbd{C-u} prefix, the last
282 inserted counter value is repeated and the counter is not incremented.
283 For example, if you enter the following sequence while defining a macro
285 @example
286 C-x C-k C-i C-x C-k C-i C-u C-x C-k C-i C-x C-k C-i
287 @end example
289 @noindent
290 the text @samp{0112} is inserted in the buffer, and for the first and
291 second execution of the macro @samp{3445} and @samp{6778} are
292 inserted.
294   This command usually only makes sense while defining a keyboard macro.
295 But its behavior when no keyboard macro is being defined or executed
296 is predictable: it inserts and increments the counter of the head of
297 the keyboard macro ring.
299 @findex kmacro-set-counter
300 @kindex C-x C-k C-c
301   The command @kbd{C-x C-k C-c} (@code{kmacro-set-counter}) prompts
302 for the initial value of the keyboard macro counter if you use it
303 before you define a keyboard macro.  If you use it before executing a
304 keyboard macro, it resets that macro's counter.  If you use it while
305 defining a keyboard macro, then the macro counter gets reset to that same
306 value on each repetition of the macro.  Rather than having the command
307 prompt for a value, you can also specify the value with a numeric
308 prefix argument.  If you just specify a @kbd{C-u} prefix, the counter
309 is reset to the value it had prior to the current repetition of the
310 macro (undoing any increments so far in this repetition).  If you just
311 specify a @kbd{C-u} prefix while no macro is being defined or executed,
312 then the new value of the counter is essentially unpredictable.
314 @findex kmacro-add-counter
315 @kindex C-x C-k C-a
316   The command @kbd{C-x C-k C-a} (@code{kmacro-add-counter}) prompts
317 for a value to add to the macro counter.  You can also specify the
318 value with a numeric prefix argument.  If you just specify a @kbd{C-u}
319 prefix, the counter is reset to the last value inserted by any
320 keyboard macro.  Usually, this will only make sense if that value was
321 inserted during the current macro definition or repetition.
323   This command normally only makes sense while defining a keyboard macro.
324 But its behavior when no keyboard macro is being defined or executed
325 is predictable: it affects the counter of the head of the keyboard
326 macro ring.
328 @findex kmacro-set-format
329 @kindex C-x C-k C-f
330   The command @kbd{C-x C-k C-f} (@code{kmacro-set-format}) prompts for
331 the format to use when inserting the macro counter.  The default
332 format is @samp{%d}, which means to insert the number in decimal
333 without any padding.  You can exit with empty minibuffer to reset the
334 format to this default.  You can specify any format string that the
335 @code{format} function accepts and that makes sense with a single
336 integer extra argument (@pxref{Formatting Strings,,, elisp, The Emacs
337 Lisp Reference Manual}).  Do not put the format string inside double
338 quotes when you insert it in the minibuffer.
340 If you use this command while no keyboard macro is being defined or
341 executed, the new format affects all subsequent macro definitions.
342 Existing macros continue to use the format in effect when they were
343 defined.  If you set the format while defining a keyboard macro, this
344 affects the macro being defined from that point on, but it does not
345 affect subsequent macros.  Execution of the macro will, at each step,
346 use the format in effect at that step during its definition.  Changes
347 to the macro format during execution of a macro, like the
348 corresponding changes during its definition, have no effect on
349 subsequent macros.
351 The format set by @kbd{C-x C-k C-f} does not affect insertion of
352 numbers stored in registers.
354 @node Keyboard Macro Query
355 @section Executing Macros with Variations
357 @kindex C-x q
358 @findex kbd-macro-query
359   Using @kbd{C-x q} (@code{kbd-macro-query}), you can get an effect
360 similar to that of @code{query-replace}, where the macro asks you each
361 time around whether to make a change.  While defining the macro,
362 type @kbd{C-x q} at the point where you want the query to occur.  During
363 macro definition, the @kbd{C-x q} does nothing, but when you run the
364 macro later, @kbd{C-x q} asks you interactively whether to continue.
366   The valid responses when @kbd{C-x q} asks are @key{SPC} (or @kbd{y}),
367 @key{DEL} (or @kbd{n}), @key{RET} (or @kbd{q}), @kbd{C-l} and @kbd{C-r}.
368 The answers are the same as in @code{query-replace}, though not all of
369 the @code{query-replace} options are meaningful.
371   These responses include @key{SPC} to continue, and @key{DEL} to skip
372 the remainder of this repetition of the macro and start right away with
373 the next repetition.  @key{RET} means to skip the remainder of this
374 repetition and cancel further repetitions.  @kbd{C-l} redraws the screen
375 and asks you again for a character to say what to do.
377   @kbd{C-r} enters a recursive editing level, in which you can perform
378 editing which is not part of the macro.  When you exit the recursive
379 edit using @kbd{C-M-c}, you are asked again how to continue with the
380 keyboard macro.  If you type a @key{SPC} at this time, the rest of the
381 macro definition is executed.  It is up to you to leave point and the
382 text in a state such that the rest of the macro will do what you
383 want.@refill
385   @kbd{C-u C-x q}, which is @kbd{C-x q} with a numeric argument,
386 performs a completely different function.  It enters a recursive edit
387 reading input from the keyboard, both when you type it during the
388 definition of the macro, and when it is executed from the macro.  During
389 definition, the editing you do inside the recursive edit does not become
390 part of the macro.  During macro execution, the recursive edit gives you
391 a chance to do some particularized editing on each repetition.
392 @xref{Recursive Edit}.
394   Another way to vary the behavior of a keyboard macro is to use a
395 register as a counter, incrementing it on each repetition of the macro.
396 @xref{RegNumbers}.
398 @node Save Keyboard Macro
399 @section Naming and Saving Keyboard Macros
401 @cindex saving keyboard macros
402 @findex kmacro-name-last-macro
403 @kindex C-x C-k n
404   If you wish to save a keyboard macro for later use, you can give it
405 a name using @kbd{C-x C-k n} (@code{kmacro-name-last-macro}).
406 This reads a name as an argument using the minibuffer and defines that
407 name to execute the last keyboard macro, in its current form.  (If you
408 later add to the definition of this macro, that does not alter the
409 name's definition as a macro.)  The macro name is a Lisp symbol, and
410 defining it in this way makes it a valid command name for calling with
411 @kbd{M-x} or for binding a key to with @code{global-set-key}
412 (@pxref{Keymaps}).  If you specify a name that has a prior definition
413 other than a keyboard macro, an error message is shown and nothing is
414 changed.
416 @cindex binding keyboard macros
417 @findex kmacro-bind-to-key
418 @kindex C-x C-k b
419   You can also bind the last keyboard macro (in its current form) to a
420 key, using @kbd{C-x C-k b} (@code{kmacro-bind-to-key}) followed by the
421 key sequence you want to bind.  You can bind to any key sequence in
422 the global keymap, but since most key sequences already have other
423 bindings, you should select the key sequence carefully.  If you try to
424 bind to a key sequence with an existing binding (in any keymap), this
425 command asks you for confirmation before replacing the existing binding.
427 To avoid problems caused by overriding existing bindings, the key
428 sequences @kbd{C-x C-k 0} through @kbd{C-x C-k 9} and @kbd{C-x C-k A}
429 through @kbd{C-x C-k Z} are reserved for your own keyboard macro
430 bindings.  In fact, to bind to one of these key sequences, you only
431 need to type the digit or letter rather than the whole key sequences.
432 For example,
434 @example
435 C-x C-k b 4
436 @end example
438 @noindent
439 will bind the last keyboard macro to the key sequence @kbd{C-x C-k 4}.
441 @findex insert-kbd-macro
442   Once a macro has a command name, you can save its definition in a file.
443 Then it can be used in another editing session.  First, visit the file
444 you want to save the definition in.  Then use this command:
446 @example
447 M-x insert-kbd-macro @key{RET} @var{macroname} @key{RET}
448 @end example
450 @noindent
451 This inserts some Lisp code that, when executed later, will define the
452 same macro with the same definition it has now.  (You need not
453 understand Lisp code to do this, because @code{insert-kbd-macro} writes
454 the Lisp code for you.)  Then save the file.  You can load the file
455 later with @code{load-file} (@pxref{Lisp Libraries}).  If the file you
456 save in is your init file @file{~/.emacs} (@pxref{Init File}) then the
457 macro will be defined each time you run Emacs.
459   If you give @code{insert-kbd-macro} a numeric argument, it makes
460 additional Lisp code to record the keys (if any) that you have bound
461 to @var{macroname}, so that the macro will be reassigned the same keys
462 when you load the file.
464 @node Edit Keyboard Macro
465 @section Editing a Keyboard Macro
467 @findex kmacro-edit-macro
468 @kindex C-x C-k C-e
469 @kindex C-x C-k RET
470   You can edit the last keyboard macro by typing @kbd{C-x C-k C-e} or
471 @kbd{C-x C-k RET} (@code{kmacro-edit-macro}).  This formats the macro
472 definition in a buffer and enters a specialized major mode for editing
473 it.  Type @kbd{C-h m} once in that buffer to display details of how to
474 edit the macro.  When you are finished editing, type @kbd{C-c C-c}.
476 @findex edit-kbd-macro
477 @kindex C-x C-k e
478   You can edit a named keyboard macro or a macro bound to a key by typing
479 @kbd{C-x C-k e} (@code{edit-kbd-macro}).  Follow that with the
480 keyboard input that you would use to invoke the macro---@kbd{C-x e} or
481 @kbd{M-x @var{name}} or some other key sequence.
483 @findex kmacro-edit-lossage
484 @kindex C-x C-k l
485   You can edit the last 100 keystrokes as a macro by typing
486 @kbd{C-x C-k l} (@code{kmacro-edit-lossage}).
488 @node Keyboard Macro Step-Edit
489 @section Stepwise Editing a Keyboard Macro
491 @findex kmacro-step-edit-macro
492 @kindex C-x C-k SPC
493   You can interactively and stepwise replay and edit the last keyboard
494 macro one command at a time by typing @kbd{C-x C-k SPC}
495 (@code{kmacro-step-edit-macro}).  Unless you quit the macro using
496 @kbd{q} or @kbd{C-g}, the edited macro replaces the last macro on the
497 macro ring.
499 This shows the last macro in the minibuffer together with the first
500 (or next) command to be executed, and prompts you for an action.
501 You can enter @kbd{?} to get a command summary.
503 The following commands are available in the step-edit mode and relate
504 to the first (or current) command in the keyboard macro:
506 @itemize @bullet{}
507 @item
508 @kbd{SPC} and @kbd{y} execute the current command, and advance to the
509 next command in the keyboard macro.
510 @item
511 @kbd{n}, @kbd{d}, and @kbd{DEL} skip and delete the current command.
512 @item
513 @kbd{f} skips the current command in this execution of the keyboard
514 macro, but doesn't delete it from the macro.
515 @item
516 @kbd{TAB} executes the current command, as well as all similar
517 commands immediately following the current command; for example, TAB
518 may be used to insert a sequence of characters (corresponding to a
519 sequence of @code{self-insert-command} commands).
520 @item
521 @kbd{c} continues execution (without further editing) until the end of
522 the keyboard macro.  If execution terminates normally, the edited
523 macro replaces the original keyboard macro.
524 @item
525 @kbd{C-k} skips and deletes the rest of the keyboard macro,
526 terminates step-editing, and replaces the original keyboard macro
527 with the edited macro.
528 @item
529 @kbd{q} and @kbd{C-g} cancels the step-editing of the keyboard macro;
530 discarding any changes made to the keyboard macro.
531 @item
532 @kbd{i KEY... C-j} reads and executes a series of key sequences (not
533 including the final @kbd{C-j}), and inserts them before the current
534 command in the keyboard macro, without advancing over the current
535 command.
536 @item
537 @kbd{I KEY...} reads one key sequence, executes it, and inserts it
538 before the current command in the keyboard macro, without advancing
539 over the current command.
540 @item
541 @kbd{r KEY... C-j} reads and executes a series of key sequences (not
542 including the final @kbd{C-j}), and replaces the current command in
543 the keyboard macro with them, advancing over the inserted key
544 sequences.
545 @item
546 @kbd{R KEY...} reads one key sequence, executes it, and replaces the
547 current command in the keyboard macro with that key sequence,
548 advancing over the inserted key sequence.
549 @item
550 @kbd{a KEY... C-j} executes the current command, then reads and
551 executes a series of key sequences (not including the final
552 @kbd{C-j}), and inserts them after the current command in the keyboard
553 macro; it then advances over the current command and the inserted key
554 sequences.
555 @item
556 @kbd{A KEY... C-j} executes the rest of the commands in the keyboard
557 macro, then reads and executes a series of key sequences (not
558 including the final @kbd{C-j}), and appends them at the end of the
559 keyboard macro; it then terminates the step-editing and replaces the
560 original keyboard macro with the edited macro.
561 @end itemize
563 @ignore
564    arch-tag: c1b0dd3b-3159-4c08-928f-52e763953e9c
565 @end ignore