diff options
| author | Luc Teirlinck | 2004-12-02 00:36:51 +0000 |
|---|---|---|
| committer | Luc Teirlinck | 2004-12-02 00:36:51 +0000 |
| commit | 34768dde09dd83cf0b64d9857df89c89bb0a2de8 (patch) | |
| tree | fd5e351d141ebf64014df113d0ccf5385440bdc2 | |
| parent | 7dcb2dfd8acf9c453f746a3b76fcd12aa2119ed8 (diff) | |
| download | emacs-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.texi | 109 |
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 | |||
| 120 | indefinitely (until it gets an error or you type @kbd{C-g} or, on | 120 | indefinitely (until it gets an error or you type @kbd{C-g} or, on |
| 121 | MS-DOS, @kbd{C-@key{BREAK}}). | 121 | MS-DOS, @kbd{C-@key{BREAK}}). |
| 122 | 122 | ||
| 123 | @kindex C-x C-k C-s | ||
| 124 | @kindex C-x C-k C-k | ||
| 125 | Alternatively, you can use @kbd{C-x C-k C-s} to start a keyboard macro, | ||
| 126 | and @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 |
| 129 | text, define a macro and include as part of the macro the commands to move | 124 | text, define a macro and include as part of the macro the commands to move |
| 130 | to the next place you want to use it. For example, if you want to change | 125 | to 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. | |||
| 185 | a list of sequences of keys. There is only one keyboard macro ring, | 180 | a list of sequences of keys. There is only one keyboard macro ring, |
| 186 | shared by all buffers. | 181 | shared 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 |
| 189 | same @kbd{C-x C-k} prefix. Most of these commands can be executed and | 184 | same @kbd{C-x C-k} prefix. Most of these commands can be executed and |
| 190 | repeated immediately after each other without repeating the @kbd{C-x | 185 | repeated immediately after each other without repeating the @kbd{C-x |
| 191 | C-k} prefix. For example, | 186 | C-k} prefix. For example, |
| @@ -207,12 +202,17 @@ executes the keyboard macro at the head of the macro ring. You can | |||
| 207 | repeat the macro immediately by typing another @kbd{C-k}, or you can | 202 | repeat the macro immediately by typing another @kbd{C-k}, or you can |
| 208 | rotate the macro ring immediately by typing @kbd{C-n} or @kbd{C-p}. | 203 | rotate the macro ring immediately by typing @kbd{C-n} or @kbd{C-p}. |
| 209 | 204 | ||
| 205 | When a keyboard macro is being defined, @kbd{C-x C-k C-k} behaves like | ||
| 206 | @kbd{C-x )} except that, immediately afterward, you can use most key | ||
| 207 | bindings of this section without the @kbd{C-x C-k} prefix. For | ||
| 208 | instance, another @kbd{C-k} will re-execute the macro. | ||
| 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 |
| 216 | macro ring, bringing the next or previous keyboard macro to the head | 216 | macro ring, bringing the next or previous keyboard macro to the head |
| 217 | of the macro ring. The definition of the new head macro is displayed | 217 | of the macro ring. The definition of the new head macro is displayed |
| 218 | in the echo area. You can continue to rotate the macro ring | 218 | in 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}) |
| 231 | displays the last keyboard macro, or when repeated (with @kbd{C-v}), | 231 | displays the last keyboard macro, or when repeated (with @kbd{C-v}), |
| 232 | it displays the previous macro on the macro ring, just like @kbd{C-x | 232 | it displays the previous macro on the macro ring, just like @kbd{C-x |
| 233 | C-k C-p}, but without actually rotating the macro ring. If you enter | 233 | C-k C-p}, but without actually rotating the macro ring. If you enter |
| 234 | @kbd{C-k} immediately after displaying a macro from the ring, that | 234 | @kbd{C-k} immediately after displaying a macro from the ring, that |
| 235 | macro is executed, but still without altering the macro ring. | 235 | macro 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 |
| 238 | macro the current macro and executes it twice, @kbd{C-x C-k C-v C-v | 238 | macro the current macro and executes it twice, @kbd{C-x C-k C-v C-v |
| 239 | C-v C-k C-k} will display and execute the 3rd previous macro once and | 239 | C-v C-k C-k} will display and execute the 3rd previous macro once and |
| 240 | then the current macro once. | 240 | then 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}) |
| 246 | removes and deletes the macro currently at the head of the macro | 246 | removes and deletes the macro currently at the head of the macro |
| 247 | ring. You can use this to delete a macro that didn't work as | 247 | ring. You can use this to delete a macro that didn't work as |
| 248 | expected, or which you don't need anymore. | 248 | expected, 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}) |
| 254 | interchanges the head of the macro ring with the previous element on | 254 | interchanges the head of the macro ring with the previous element on |
| 255 | the macro ring. | 255 | the 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}) |
| 261 | executes the previous (rather than the head) element on the macro ring. | 261 | executes 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 | ||
| 265 | determined 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 |
| 267 | incremented on every repetition of the keyboard macro. Normally, the | ||
| 268 | macro counter is initialized to 0 when you start defining the macro, | 271 | macro counter is initialized to 0 when you start defining the macro, |
| 269 | and incremented by 1 after each insertion of the counter value; | 272 | and incremented by 1 after each insertion of the counter value; |
| 270 | that is, if you insert the macro counter twice while defining the | 273 | that 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 |
| 276 | the current value of the keyboard macro counter and increments the | 279 | the current value of the keyboard macro counter and increments the |
| 277 | counter by 1. You can use a numeric prefix argument to specify a | 280 | counter by 1. You can use a numeric prefix argument to specify a |
| 278 | different increment. If you specify a @kbd{C-u} prefix, the last | 281 | different increment. If you just specify a @kbd{C-u} prefix, the last |
| 279 | inserted counter value is repeated and the counter is not incremented. | 282 | inserted counter value is repeated and the counter is not incremented. |
| 280 | For example, if you enter the following sequence while defining a macro | 283 | For 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 | |||
| 288 | second execution of the macro @samp{3445} and @samp{6778} are | 291 | second execution of the macro @samp{3445} and @samp{6778} are |
| 289 | inserted. | 292 | inserted. |
| 290 | 293 | ||
| 294 | This command usually only makes sense while defining a keyboard macro. | ||
| 295 | But its behavior when no keyboard macro is being defined or executed | ||
| 296 | is predictable: it inserts and increments the counter of the head of | ||
| 297 | the keyboard macro ring. | ||
| 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 |
| 294 | for the initial value of the keyboard macro counter if you use it | 302 | for the initial value of the keyboard macro counter if you use it |
| 295 | before you define a keyboard macro. If you use it while defining a | 303 | before you define a keyboard macro. If you use it before executing a |
| 296 | keyboard macro, you set the macro counter to the same (initial) value | 304 | keyboard macro, it resets that macro's counter. If you use it while |
| 297 | on each repetition of the macro. If you specify a @kbd{C-u} prefix, | 305 | defining a keyboard macro, then the macro counter gets reset to that same |
| 298 | the counter is reset to the value it had prior to the current | 306 | value on each repetition of the macro. Rather than having the command |
| 299 | repetition of the macro (undoing any increments so far in this | 307 | prompt for a value, you can also specify the value with a numeric |
| 300 | repetition). | 308 | prefix argument. If you just specify a @kbd{C-u} prefix, the counter |
| 309 | is reset to the value it had prior to the current repetition of the | ||
| 310 | macro (undoing any increments so far in this repetition). If you just | ||
| 311 | specify a @kbd{C-u} prefix while no macro is being defined or executed, | ||
| 312 | then the new value of the counter is essentially unpredictable. | ||
| 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 |
| 305 | for a value to add to the macro counter. | 317 | for a value to add to the macro counter. You can also specify the |
| 318 | value with a numeric prefix argument. If you just specify a @kbd{C-u} | ||
| 319 | prefix, the counter is reset to the last value inserted by any | ||
| 320 | keyboard macro. Usually, this will only make sense if that value was | ||
| 321 | inserted during the current macro definition or repetition. | ||
| 322 | |||
| 323 | This command normally only makes sense while defining a keyboard macro. | ||
| 324 | But its behavior when no keyboard macro is being defined or executed | ||
| 325 | is predictable: it affects the counter of the head of the keyboard | ||
| 326 | macro ring. | ||
| 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 |
| 310 | for the format to use when inserting the macro counter. The default | 331 | the format to use when inserting the macro counter. The default |
| 311 | format is @samp{%d}. If you set the counter format before you define a | 332 | format is @samp{%d}, which means to insert the number in decimal |
| 312 | macro, that format is restored before each repetition of the macro. | 333 | without any padding. You can exit with empty minibuffer to reset the |
| 313 | Consequently, any changes you make to the macro counter format while | 334 | format to this default. You can specify any format string that the |
| 314 | defining a macro are only active for the rest of the macro. | 335 | @code{format} function accepts and that makes sense with a single |
| 336 | integer extra argument (@pxref{Formatting Strings,,, elisp, The Emacs | ||
| 337 | Lisp Reference Manual}). Do not put the format string inside double | ||
| 338 | quotes when you insert it in the minibuffer. | ||
| 339 | |||
| 340 | If you use this command while no keyboard macro is being defined or | ||
| 341 | executed, the new format affects all subsequent macro definitions. | ||
| 342 | Existing macros continue to use the format in effect when they were | ||
| 343 | defined. If you set the format while defining a keyboard macro, this | ||
| 344 | affects the macro being defined from that point on, but it does not | ||
| 345 | affect subsequent macros. Execution of the macro will, at each step, | ||
| 346 | use the format in effect at that step during its definition. Changes | ||
| 347 | to the macro format during execution of a macro, like the | ||
| 348 | corresponding changes during its definition, have no effect on | ||
| 349 | subsequent macros. | ||
| 350 | |||
| 351 | The format set by @kbd{C-x C-k C-f} does not affect insertion of | ||
| 352 | numbers 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 | 420 | key, using @kbd{C-x C-k b} (@code{kmacro-bind-to-key}) followed by the |
| 383 | key sequence you want the keyboard macro to be bound to. You can | 421 | key sequence you want to bind. You can bind to any key sequence in |
| 384 | bind to any key sequence in the global keymap, but since most key | 422 | the global keymap, but since most key sequences already have other |
| 385 | sequences already have other bindings, you should select the key | 423 | bindings, you should select the key sequence carefully. If you try to |
| 386 | sequence carefully. If you try to bind to a key sequence with an | 424 | bind to a key sequence with an existing binding (in any keymap), this |
| 387 | existing binding (in any keymap), you will be asked if you really | 425 | command asks you for confirmation before replacing the existing binding. |
| 388 | want to replace the existing binding of that key. | ||
| 389 | 426 | ||
| 390 | To avoid problems caused by overriding existing bindings, the key | 427 | To avoid problems caused by overriding existing bindings, the key |
| 391 | sequences @kbd{C-x C-k 0} through @kbd{C-x C-k 9} and @kbd{C-x C-k A} | 428 | sequences @kbd{C-x C-k 0} through @kbd{C-x C-k 9} and @kbd{C-x C-k A} |