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