aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuc Teirlinck2004-12-02 00:36:51 +0000
committerLuc Teirlinck2004-12-02 00:36:51 +0000
commit34768dde09dd83cf0b64d9857df89c89bb0a2de8 (patch)
treefd5e351d141ebf64014df113d0ccf5385440bdc2
parent7dcb2dfd8acf9c453f746a3b76fcd12aa2119ed8 (diff)
downloademacs-34768dde09dd83cf0b64d9857df89c89bb0a2de8.tar.gz
emacs-34768dde09dd83cf0b64d9857df89c89bb0a2de8.zip
Several small changes in addition to the following.
(Keyboard Macro Ring): Describe behavior of `C-x C-k C-k' when defining a keyboard macro. Mention `kmacro-ring-max'. (Keyboard Macro Counter): Clarify description of `kmacro-insert-counter', `kmacro-set-counter', `kmacro-add-counter' and `kmacro-set-format'.
-rw-r--r--man/kmacro.texi109
1 files changed, 73 insertions, 36 deletions
diff --git a/man/kmacro.texi b/man/kmacro.texi
index c07602bc77f..459752d3c4b 100644
--- a/man/kmacro.texi
+++ b/man/kmacro.texi
@@ -120,11 +120,6 @@ of zero to @kbd{C-x e} or @kbd{C-x )} means repeat the macro
120indefinitely (until it gets an error or you type @kbd{C-g} or, on 120indefinitely (until it gets an error or you type @kbd{C-g} or, on
121MS-DOS, @kbd{C-@key{BREAK}}). 121MS-DOS, @kbd{C-@key{BREAK}}).
122 122
123@kindex C-x C-k C-s
124@kindex C-x C-k C-k
125Alternatively, you can use @kbd{C-x C-k C-s} to start a keyboard macro,
126and @kbd{C-x C-k C-k...} to end and execute it.
127
128 If you wish to repeat an operation at regularly spaced places in the 123 If you wish to repeat an operation at regularly spaced places in the
129text, define a macro and include as part of the macro the commands to move 124text, define a macro and include as part of the macro the commands to move
130to the next place you want to use it. For example, if you want to change 125to the next place you want to use it. For example, if you want to change
@@ -185,7 +180,7 @@ beginning of the line and then executing the macro.
185a list of sequences of keys. There is only one keyboard macro ring, 180a list of sequences of keys. There is only one keyboard macro ring,
186shared by all buffers. 181shared by all buffers.
187 182
188 All commands which operates on the keyboard macro ring use the 183 All commands which operate on the keyboard macro ring use the
189same @kbd{C-x C-k} prefix. Most of these commands can be executed and 184same @kbd{C-x C-k} prefix. Most of these commands can be executed and
190repeated immediately after each other without repeating the @kbd{C-x 185repeated immediately after each other without repeating the @kbd{C-x
191C-k} prefix. For example, 186C-k} prefix. For example,
@@ -207,12 +202,17 @@ executes the keyboard macro at the head of the macro ring. You can
207repeat the macro immediately by typing another @kbd{C-k}, or you can 202repeat the macro immediately by typing another @kbd{C-k}, or you can
208rotate the macro ring immediately by typing @kbd{C-n} or @kbd{C-p}. 203rotate the macro ring immediately by typing @kbd{C-n} or @kbd{C-p}.
209 204
205When a keyboard macro is being defined, @kbd{C-x C-k C-k} behaves like
206@kbd{C-x )} except that, immediately afterward, you can use most key
207bindings of this section without the @kbd{C-x C-k} prefix. For
208instance, another @kbd{C-k} will re-execute the macro.
209
210@findex kmacro-cycle-ring-next 210@findex kmacro-cycle-ring-next
211@kindex C-x C-k C-n 211@kindex C-x C-k C-n
212@findex kmacro-cycle-ring-previous 212@findex kmacro-cycle-ring-previous
213@kindex C-x C-k C-p 213@kindex C-x C-k C-p
214 The commands @kbd{C-x C-k C-n} (@code{kmacro-cycle-ring-next}) and 214 The commands @kbd{C-x C-k C-n} (@code{kmacro-cycle-ring-next}) and
215@kbd{C-x C-k C-p} (@code{kmacro-cycle-ring-previous}) rotates the 215@kbd{C-x C-k C-p} (@code{kmacro-cycle-ring-previous}) rotate the
216macro ring, bringing the next or previous keyboard macro to the head 216macro ring, bringing the next or previous keyboard macro to the head
217of the macro ring. The definition of the new head macro is displayed 217of the macro ring. The definition of the new head macro is displayed
218in the echo area. You can continue to rotate the macro ring 218in the echo area. You can continue to rotate the macro ring
@@ -227,14 +227,14 @@ defined keyboard macro''. For instance, it is the keyboard macro that
227@findex kmacro-view-macro-repeat 227@findex kmacro-view-macro-repeat
228@kindex C-x C-k C-v 228@kindex C-x C-k C-v
229 229
230 The commands @kbd{C-x C-k C-v} (@code{kmacro-view-macro-repeat}) 230 The command @kbd{C-x C-k C-v} (@code{kmacro-view-macro-repeat})
231displays the last keyboard macro, or when repeated (with @kbd{C-v}), 231displays the last keyboard macro, or when repeated (with @kbd{C-v}),
232it displays the previous macro on the macro ring, just like @kbd{C-x 232it displays the previous macro on the macro ring, just like @kbd{C-x
233C-k C-p}, but without actually rotating the macro ring. If you enter 233C-k C-p}, but without actually rotating the macro ring. If you enter
234@kbd{C-k} immediately after displaying a macro from the ring, that 234@kbd{C-k} immediately after displaying a macro from the ring, that
235macro is executed, but still without altering the macro ring. 235macro is executed, but still without altering the macro ring.
236 236
237 So while e.g. @kbd{C-x C-k C-p C-p C-k C-k} makes the 3rd previous 237 So while e.g. @kbd{C-x C-k C-p C-p C-p C-k C-k} makes the 3rd previous
238macro the current macro and executes it twice, @kbd{C-x C-k C-v C-v 238macro the current macro and executes it twice, @kbd{C-x C-k C-v C-v
239C-v C-k C-k} will display and execute the 3rd previous macro once and 239C-v C-k C-k} will display and execute the 3rd previous macro once and
240then the current macro once. 240then the current macro once.
@@ -242,7 +242,7 @@ then the current macro once.
242@findex kmacro-delete-ring-head 242@findex kmacro-delete-ring-head
243@kindex C-x C-k C-d 243@kindex C-x C-k C-d
244 244
245 The commands @kbd{C-x C-k C-d} (@code{kmacro-delete-ring-head}) 245 The command @kbd{C-x C-k C-d} (@code{kmacro-delete-ring-head})
246removes and deletes the macro currently at the head of the macro 246removes and deletes the macro currently at the head of the macro
247ring. You can use this to delete a macro that didn't work as 247ring. You can use this to delete a macro that didn't work as
248expected, or which you don't need anymore. 248expected, or which you don't need anymore.
@@ -250,21 +250,24 @@ expected, or which you don't need anymore.
250@findex kmacro-swap-ring 250@findex kmacro-swap-ring
251@kindex C-x C-k C-t 251@kindex C-x C-k C-t
252 252
253 The commands @kbd{C-x C-k C-t} (@code{kmacro-swap-ring}) 253 The command @kbd{C-x C-k C-t} (@code{kmacro-swap-ring})
254interchanges the head of the macro ring with the previous element on 254interchanges the head of the macro ring with the previous element on
255the macro ring. 255the macro ring.
256 256
257@findex kmacro-call-ring-2nd-repeat 257@findex kmacro-call-ring-2nd-repeat
258@kindex C-x C-k C-l 258@kindex C-x C-k C-l
259 259
260 The commands @kbd{C-x C-k C-l} (@code{kmacro-call-ring-2nd-repeat}) 260 The command @kbd{C-x C-k C-l} (@code{kmacro-call-ring-2nd-repeat})
261executes the previous (rather than the head) element on the macro ring. 261executes the previous (rather than the head) element on the macro ring.
262 262
263@vindex kmacro-ring-max
264 The maximum number of macros stored in the keyboard macro ring is
265determined by the customizable variable @code{kmacro-ring-max}.
266
263@node Keyboard Macro Counter 267@node Keyboard Macro Counter
264@section The Keyboard Macro Counter 268@section The Keyboard Macro Counter
265 269
266 Each keyboard macro has an associated counter which is automatically 270 Each keyboard macro has an associated counter. Normally, the
267incremented on every repetition of the keyboard macro. Normally, the
268macro counter is initialized to 0 when you start defining the macro, 271macro counter is initialized to 0 when you start defining the macro,
269and incremented by 1 after each insertion of the counter value; 272and incremented by 1 after each insertion of the counter value;
270that is, if you insert the macro counter twice while defining the 273that is, if you insert the macro counter twice while defining the
@@ -275,7 +278,7 @@ macro, the counter will increase by 2 on each repetition of the macro.
275 The command @kbd{C-x C-k C-i} (@code{kmacro-insert-counter}) inserts 278 The command @kbd{C-x C-k C-i} (@code{kmacro-insert-counter}) inserts
276the current value of the keyboard macro counter and increments the 279the current value of the keyboard macro counter and increments the
277counter by 1. You can use a numeric prefix argument to specify a 280counter by 1. You can use a numeric prefix argument to specify a
278different increment. If you specify a @kbd{C-u} prefix, the last 281different increment. If you just specify a @kbd{C-u} prefix, the last
279inserted counter value is repeated and the counter is not incremented. 282inserted counter value is repeated and the counter is not incremented.
280For example, if you enter the following sequence while defining a macro 283For example, if you enter the following sequence while defining a macro
281 284
@@ -288,30 +291,65 @@ the text @samp{0112} is inserted in the buffer, and for the first and
288second execution of the macro @samp{3445} and @samp{6778} are 291second execution of the macro @samp{3445} and @samp{6778} are
289inserted. 292inserted.
290 293
294 This command usually only makes sense while defining a keyboard macro.
295But its behavior when no keyboard macro is being defined or executed
296is predictable: it inserts and increments the counter of the head of
297the keyboard macro ring.
298
291@findex kmacro-set-counter 299@findex kmacro-set-counter
292@kindex C-x C-k C-c 300@kindex C-x C-k C-c
293 The command @kbd{C-x C-k C-c} (@code{kmacro-set-counter}) prompts 301 The command @kbd{C-x C-k C-c} (@code{kmacro-set-counter}) prompts
294for the initial value of the keyboard macro counter if you use it 302for the initial value of the keyboard macro counter if you use it
295before you define a keyboard macro. If you use it while defining a 303before you define a keyboard macro. If you use it before executing a
296keyboard macro, you set the macro counter to the same (initial) value 304keyboard macro, it resets that macro's counter. If you use it while
297on each repetition of the macro. If you specify a @kbd{C-u} prefix, 305defining a keyboard macro, then the macro counter gets reset to that same
298the counter is reset to the value it had prior to the current 306value on each repetition of the macro. Rather than having the command
299repetition of the macro (undoing any increments so far in this 307prompt for a value, you can also specify the value with a numeric
300repetition). 308prefix argument. If you just specify a @kbd{C-u} prefix, the counter
309is reset to the value it had prior to the current repetition of the
310macro (undoing any increments so far in this repetition). If you just
311specify a @kbd{C-u} prefix while no macro is being defined or executed,
312then the new value of the counter is essentially unpredictable.
301 313
302@findex kmacro-add-counter 314@findex kmacro-add-counter
303@kindex C-x C-k C-a 315@kindex C-x C-k C-a
304 The command @kbd{C-x C-k C-a} (@code{kmacro-add-counter}) prompts 316 The command @kbd{C-x C-k C-a} (@code{kmacro-add-counter}) prompts
305for a value to add to the macro counter. 317for a value to add to the macro counter. You can also specify the
318value with a numeric prefix argument. If you just specify a @kbd{C-u}
319prefix, the counter is reset to the last value inserted by any
320keyboard macro. Usually, this will only make sense if that value was
321inserted during the current macro definition or repetition.
322
323 This command normally only makes sense while defining a keyboard macro.
324But its behavior when no keyboard macro is being defined or executed
325is predictable: it affects the counter of the head of the keyboard
326macro ring.
306 327
307@findex kmacro-set-format 328@findex kmacro-set-format
308@kindex C-x C-k C-f 329@kindex C-x C-k C-f
309 The command @kbd{C-x C-k C-f} (@code{kmacro-set-format}) prompts 330 The command @kbd{C-x C-k C-f} (@code{kmacro-set-format}) prompts for
310for the format to use when inserting the macro counter. The default 331the format to use when inserting the macro counter. The default
311format is @samp{%d}. If you set the counter format before you define a 332format is @samp{%d}, which means to insert the number in decimal
312macro, that format is restored before each repetition of the macro. 333without any padding. You can exit with empty minibuffer to reset the
313Consequently, any changes you make to the macro counter format while 334format to this default. You can specify any format string that the
314defining a macro are only active for the rest of the macro. 335@code{format} function accepts and that makes sense with a single
336integer extra argument (@pxref{Formatting Strings,,, elisp, The Emacs
337Lisp Reference Manual}). Do not put the format string inside double
338quotes when you insert it in the minibuffer.
339
340If you use this command while no keyboard macro is being defined or
341executed, the new format affects all subsequent macro definitions.
342Existing macros continue to use the format in effect when they were
343defined. If you set the format while defining a keyboard macro, this
344affects the macro being defined from that point on, but it does not
345affect subsequent macros. Execution of the macro will, at each step,
346use the format in effect at that step during its definition. Changes
347to the macro format during execution of a macro, like the
348corresponding changes during its definition, have no effect on
349subsequent macros.
350
351The format set by @kbd{C-x C-k C-f} does not affect insertion of
352numbers stored in registers.
315 353
316@node Keyboard Macro Query 354@node Keyboard Macro Query
317@section Executing Macros with Variations 355@section Executing Macros with Variations
@@ -378,14 +416,13 @@ changed.
378@cindex binding keyboard macros 416@cindex binding keyboard macros
379@findex kmacro-bind-to-key 417@findex kmacro-bind-to-key
380@kindex C-x C-k b 418@kindex C-x C-k b
381 You can also bind the last keyboard macro to a key, using 419 You can also bind the last keyboard macro (in its current form) to a
382@kbd{C-x C-k b} (@code{kmacro-bind-to-key}) followed by the 420key, using @kbd{C-x C-k b} (@code{kmacro-bind-to-key}) followed by the
383key sequence you want the keyboard macro to be bound to. You can 421key sequence you want to bind. You can bind to any key sequence in
384bind to any key sequence in the global keymap, but since most key 422the global keymap, but since most key sequences already have other
385sequences already have other bindings, you should select the key 423bindings, you should select the key sequence carefully. If you try to
386sequence carefully. If you try to bind to a key sequence with an 424bind to a key sequence with an existing binding (in any keymap), this
387existing binding (in any keymap), you will be asked if you really 425command asks you for confirmation before replacing the existing binding.
388want to replace the existing binding of that key.
389 426
390To avoid problems caused by overriding existing bindings, the key 427To avoid problems caused by overriding existing bindings, the key
391sequences @kbd{C-x C-k 0} through @kbd{C-x C-k 9} and @kbd{C-x C-k A} 428sequences @kbd{C-x C-k 0} through @kbd{C-x C-k 9} and @kbd{C-x C-k A}