aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman2006-02-02 04:38:27 +0000
committerRichard M. Stallman2006-02-02 04:38:27 +0000
commitf8c2e4d50a836d2159df2c242364199c3c545ff1 (patch)
tree497369b4d8aa1c3f8e9306dffd1fcc9c9c1128cb
parenta3053e277ed439b34565288a3dc04bb6f4799e06 (diff)
downloademacs-f8c2e4d50a836d2159df2c242364199c3c545ff1.tar.gz
emacs-f8c2e4d50a836d2159df2c242364199c3c545ff1.zip
Minor clarifications.
(Keyboard Macro Ring): Comment out some excessive commands. (Basic Keyboard Macro): Split up the table, putting part in each node.
-rw-r--r--man/kmacro.texi116
1 files changed, 80 insertions, 36 deletions
diff --git a/man/kmacro.texi b/man/kmacro.texi
index 852f999adac..4599dc40ae2 100644
--- a/man/kmacro.texi
+++ b/man/kmacro.texi
@@ -7,22 +7,22 @@
7@cindex defining keyboard macros 7@cindex defining keyboard macros
8@cindex keyboard macro 8@cindex keyboard macro
9 9
10 In this chapter we describe how a sequence of editing commands can 10 In this chapter we describe how to record a sequence of editing
11be recorded and repeated multiple times. 11commands so you can repeat it conveniently later.
12 12
13 A @dfn{keyboard macro} is a command defined by the user to stand for 13 A @dfn{keyboard macro} is a command defined by the user to stand for
14another sequence of keys. For example, if you discover that you are 14another sequence of keys. For example, if you discover that you are
15about to type @kbd{C-n C-d} forty times, you can speed your work by 15about to type @kbd{C-n M-d C-d} forty times, you can speed your work by
16defining a keyboard macro to do @kbd{C-n C-d} and calling it with a 16defining a keyboard macro to do @kbd{C-n M-d C-d}, and then executing
17repeat count of forty. 17it 39 more times.
18 18
19 You define a keyboard macro while executing the commands which are the 19 You define a keyboard macro by executing and recording the commands
20definition. Put differently, as you define a keyboard macro, the 20which are its definition. Put differently, as you define a keyboard
21definition is being executed for the first time. This way, you can see 21macro, the definition is being executed for the first time. This way,
22what the effects of your commands are, so that you don't have to figure 22you can see the effects of your commands, so that you don't have to
23them out in your head. When you are finished, the keyboard macro is 23figure them out in your head. When you close the definition, the
24defined and also has been, in effect, executed once. You can then do the 24keyboard macro is defined and also has been, in effect, executed once.
25whole thing over again by invoking the macro. 25You can then do the whole thing over again by invoking the macro.
26 26
27 Keyboard macros differ from ordinary Emacs commands in that they are 27 Keyboard macros differ from ordinary Emacs commands in that they are
28written in the Emacs command language rather than in Lisp. This makes it 28written in the Emacs command language rather than in Lisp. This makes it
@@ -63,19 +63,6 @@ execute the most recent keyboard macro
63Re-execute last keyboard macro, then add more keys to its definition. 63Re-execute last keyboard macro, then add more keys to its definition.
64@item C-u C-u C-x ( 64@item C-u C-u C-x (
65Add more keys to the last keyboard macro without re-executing it. 65Add more keys to the last keyboard macro without re-executing it.
66@item C-x q
67When this point is reached during macro execution, ask for confirmation
68(@code{kbd-macro-query}).
69@item C-x C-k n
70Give a command name (for the duration of the session) to the most
71recently defined keyboard macro (@code{kmacro-name-last-macro}).
72@item C-x C-k b
73Bind the most recently defined keyboard macro to a key sequence (for
74the duration of the session) (@code{kmacro-bind-to-key}).
75@item M-x insert-kbd-macro
76Insert in the buffer a keyboard macro's definition, as Lisp code.
77@item C-x C-k e
78Edit a previously defined keyboard macro (@code{edit-kbd-macro}).
79@item C-x C-k r 66@item C-x C-k r
80Run the last keyboard macro on each line that begins in the region 67Run the last keyboard macro on each line that begins in the region
81(@code{apply-macro-to-region-lines}). 68(@code{apply-macro-to-region-lines}).
@@ -157,12 +144,12 @@ of that event, the position that the mouse had while you were defining
157the macro. The effect of this may be hard to predict. (Using the 144the macro. The effect of this may be hard to predict. (Using the
158current mouse position would be even less predictable.) 145current mouse position would be even less predictable.)
159 146
160 One thing that doesn't always work well in a keyboard macro is the 147 One thing that sometimes works badly in a keyboard macro is the
161command @kbd{C-M-c} (@code{exit-recursive-edit}). When this command 148command @kbd{C-M-c} (@code{exit-recursive-edit}). When this command
162exits a recursive edit that started within the macro, it works as you'd 149exits a recursive edit that started within the macro, it works as
163expect. But if it exits a recursive edit that started before you 150you'd expect. But if it exits a recursive edit that started before
164invoked the keyboard macro, it also necessarily exits the keyboard macro 151you invoked the keyboard macro, it also necessarily exits the keyboard
165as part of the process. 152macro as part of the process.
166 153
167 After you have terminated the definition of a keyboard macro, you can add 154 After you have terminated the definition of a keyboard macro, you can add
168to the end of its definition by typing @kbd{C-u C-x (}. This is equivalent 155to the end of its definition by typing @kbd{C-u C-x (}. This is equivalent
@@ -190,6 +177,17 @@ beginning of the line and then executing the macro.
190a list of sequences of keys. There is only one keyboard macro ring, 177a list of sequences of keys. There is only one keyboard macro ring,
191shared by all buffers. 178shared by all buffers.
192 179
180@table @kbd
181@item C-x C-k C-k
182Execute the keyboard macro at the head of the ring (@code{kmacro-end-or-call-macro-repeat}).
183@item C-x C-k C-n
184Rotate the keyboard macro ring to the next macro (defined earlier)
185(@code{kmacro-cycle-ring-next}).
186@item C-x C-k C-p
187Rotate the keyboard macro ring to the previous macro (defined later)
188(@code{kmacro-cycle-ring-previous}).
189@end table
190
193 All commands which operate on the keyboard macro ring use the 191 All commands which operate on the keyboard macro ring use the
194same @kbd{C-x C-k} prefix. Most of these commands can be executed and 192same @kbd{C-x C-k} prefix. Most of these commands can be executed and
195repeated immediately after each other without repeating the @kbd{C-x 193repeated immediately after each other without repeating the @kbd{C-x
@@ -212,7 +210,7 @@ executes the keyboard macro at the head of the macro ring. You can
212repeat the macro immediately by typing another @kbd{C-k}, or you can 210repeat the macro immediately by typing another @kbd{C-k}, or you can
213rotate the macro ring immediately by typing @kbd{C-n} or @kbd{C-p}. 211rotate the macro ring immediately by typing @kbd{C-n} or @kbd{C-p}.
214 212
215When a keyboard macro is being defined, @kbd{C-x C-k C-k} behaves like 213 When a keyboard macro is being defined, @kbd{C-x C-k C-k} behaves like
216@kbd{C-x )} except that, immediately afterward, you can use most key 214@kbd{C-x )} except that, immediately afterward, you can use most key
217bindings of this section without the @kbd{C-x C-k} prefix. For 215bindings of this section without the @kbd{C-x C-k} prefix. For
218instance, another @kbd{C-k} will re-execute the macro. 216instance, another @kbd{C-k} will re-execute the macro.
@@ -231,12 +229,13 @@ desired macro is at the head of the ring. To execute the new macro
231ring head immediately, just type @kbd{C-k}. 229ring head immediately, just type @kbd{C-k}.
232 230
233 Note that Emacs treats the head of the macro ring as the ``last 231 Note that Emacs treats the head of the macro ring as the ``last
234defined keyboard macro''. For instance, it is the keyboard macro that 232defined keyboard macro.'' For instance, @kbd{C-x e} will execute that
235@kbd{C-x e} will execute. 233macro, and @kbd{C-x C-k n} will give it a name.
236 234
235@ignore @c This interface is too kludgy
236 @c and the functionality duplicates the functionality above -- rms.
237@findex kmacro-view-macro-repeat 237@findex kmacro-view-macro-repeat
238@kindex C-x C-k C-v 238@kindex C-x C-k C-v
239
240 The command @kbd{C-x C-k C-v} (@code{kmacro-view-macro-repeat}) 239 The command @kbd{C-x C-k C-v} (@code{kmacro-view-macro-repeat})
241displays the last keyboard macro, or when repeated (with @kbd{C-v}), 240displays the last keyboard macro, or when repeated (with @kbd{C-v}),
242it displays the previous macro on the macro ring, just like @kbd{C-x 241it displays the previous macro on the macro ring, just like @kbd{C-x
@@ -248,7 +247,11 @@ macro is executed, but still without altering the macro ring.
248macro the current macro and executes it twice, @kbd{C-x C-k C-v C-v 247macro the current macro and executes it twice, @kbd{C-x C-k C-v C-v
249C-v C-k C-k} will display and execute the 3rd previous macro once and 248C-v C-k C-k} will display and execute the 3rd previous macro once and
250then the current macro once. 249then the current macro once.
250@end ignore
251 251
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
252@findex kmacro-delete-ring-head 255@findex kmacro-delete-ring-head
253@kindex C-x C-k C-d 256@kindex C-x C-k C-d
254 257
@@ -269,6 +272,7 @@ the macro ring.
269 272
270 The command @kbd{C-x C-k C-l} (@code{kmacro-call-ring-2nd-repeat}) 273 The command @kbd{C-x C-k C-l} (@code{kmacro-call-ring-2nd-repeat})
271executes the previous (rather than the head) element on the macro ring. 274executes the previous (rather than the head) element on the macro ring.
275@end ignore
272 276
273@vindex kmacro-ring-max 277@vindex kmacro-ring-max
274 The maximum number of macros stored in the keyboard macro ring is 278 The maximum number of macros stored in the keyboard macro ring is
@@ -277,6 +281,19 @@ determined by the customizable variable @code{kmacro-ring-max}.
277@node Keyboard Macro Counter 281@node Keyboard Macro Counter
278@section The Keyboard Macro Counter 282@section The Keyboard Macro Counter
279 283
284@table @kbd
285@item C-x C-k C-i
286Insert the keyboard macro counter value in the buffer
287(@code{kmacro-insert-counter}).
288@item C-x C-k C-c
289Set the keyboard macro counter (@code{kmacro-set-counter}).
290@item C-x C-k C-a
291Add the prefix arg to the keyboard macro counter (@code{kmacro-add-counter}).
292@item C-x C-k C-f
293Specify the format for inserting the keyboard macro counter
294(@code{kmacro-set-format}).
295@end table
296
280 Each keyboard macro has an associated counter. Normally, the 297 Each keyboard macro has an associated counter. Normally, the
281macro counter is initialized to 0 when you start defining the macro, 298macro counter is initialized to 0 when you start defining the macro,
282and incremented by 1 after each insertion of the counter value; 299and incremented by 1 after each insertion of the counter value;
@@ -364,6 +381,12 @@ numbers stored in registers.
364@node Keyboard Macro Query 381@node Keyboard Macro Query
365@section Executing Macros with Variations 382@section Executing Macros with Variations
366 383
384@table @kbd
385@item C-x q
386When this point is reached during macro execution, ask for confirmation
387(@code{kbd-macro-query}).
388@end table
389
367@kindex C-x q 390@kindex C-x q
368@findex kbd-macro-query 391@findex kbd-macro-query
369 Using @kbd{C-x q} (@code{kbd-macro-query}), you can get an effect 392 Using @kbd{C-x q} (@code{kbd-macro-query}), you can get an effect
@@ -408,6 +431,17 @@ register as a counter, incrementing it on each repetition of the macro.
408@node Save Keyboard Macro 431@node Save Keyboard Macro
409@section Naming and Saving Keyboard Macros 432@section Naming and Saving Keyboard Macros
410 433
434@table
435@item C-x C-k n
436Give a command name (for the duration of the Emacs session) to the most
437recently defined keyboard macro (@code{kmacro-name-last-macro}).
438@item C-x C-k b
439Bind the most recently defined keyboard macro to a key sequence (for
440the duration of the session) (@code{kmacro-bind-to-key}).
441@item M-x insert-kbd-macro
442Insert in the buffer a keyboard macro's definition, as Lisp code.
443@end table
444
411@cindex saving keyboard macros 445@cindex saving keyboard macros
412@findex kmacro-name-last-macro 446@findex kmacro-name-last-macro
413@kindex C-x C-k n 447@kindex C-x C-k n
@@ -434,7 +468,7 @@ bindings, you should select the key sequence carefully. If you try to
434bind to a key sequence with an existing binding (in any keymap), this 468bind to a key sequence with an existing binding (in any keymap), this
435command asks you for confirmation before replacing the existing binding. 469command asks you for confirmation before replacing the existing binding.
436 470
437To avoid problems caused by overriding existing bindings, the key 471 To avoid problems caused by overriding existing bindings, the key
438sequences @kbd{C-x C-k 0} through @kbd{C-x C-k 9} and @kbd{C-x C-k A} 472sequences @kbd{C-x C-k 0} through @kbd{C-x C-k 9} and @kbd{C-x C-k A}
439through @kbd{C-x C-k Z} are reserved for your own keyboard macro 473through @kbd{C-x C-k Z} are reserved for your own keyboard macro
440bindings. In fact, to bind to one of these key sequences, you only 474bindings. In fact, to bind to one of these key sequences, you only
@@ -474,6 +508,16 @@ when you load the file.
474@node Edit Keyboard Macro 508@node Edit Keyboard Macro
475@section Editing a Keyboard Macro 509@section Editing a Keyboard Macro
476 510
511@table @kbd
512@item C-x C-k C-e
513Edit the last defined keyboard macro (@code{kmacro-edit-macro}).
514@item C-x C-k e @var{name} @key{RET}
515Edit a previously defined keyboard macro @var{name} (@code{edit-kbd-macro}).
516@item C-x C-k l
517Edit the last 100 keystrokes as a keyboard macro
518(@code{kmacro-edit-lossage}).
519@end table
520
477@findex kmacro-edit-macro 521@findex kmacro-edit-macro
478@kindex C-x C-k C-e 522@kindex C-x C-k C-e
479@kindex C-x C-k RET 523@kindex C-x C-k RET