contentvast.blogg.se

Emacs macros
Emacs macros







The command ‘C-x C-k C-f’ ( ‘kmacro-set-format’) prompts for the format to use when inserting the macro counter. The command ‘C-x C-k C-a’ ( ‘kmacro-add-counter’) prompts for a value to add to the macro counter. If you specify a ‘C-u’ prefix, the counter is reset to the value it had prior to the current repetition of the macro (undoing any increments so far in this repetition). If you use it while defining a keyboard macro, you set the macro counter to the same (initial) value on each repetition of the macro. The command ‘C-x C-k C-c’ ( ‘kmacro-set-counter’) prompts for the initial value of the keyboard macro counter if you use it before you define a keyboard macro. The text ‘0112’ is inserted in the buffer, and for the first and second execution of the macro ‘3445’ and ‘6778’ are inserted.

emacs macros

For example, if you enter the following sequence while defining a macro 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 If you specify a ‘C-u’ prefix, the last inserted counter value is repeated and the counter is not incremented.

emacs macros

You can use a numeric prefix argument to specify a different increment. The command ‘C-x C-k C-i’ ( ‘kmacro-insert-counter’) inserts the current value of the keyboard macro counter and increments the counter by 1. Normally, the macro counter is initialized to 0 when you start defining the macro, and incremented by 1 after each insertion of the counter value that is, if you insert the macro counter twice while defining the macro, it will be incremented by 2 time for each repetition of the macro.

  • Inserting incrementing numbers in macrosĮach keyboard macro has an associated counter which is automatically incremented on every repetition of the keyboard macro.








  • Emacs macros