[Univ of Cambridge] [Dept of Engineering]
next up previous contents
Next: Tags Up: Concepts Previous: Variables

Macros

To avoid repetitive key sequences you can use macros. Suppose you wanted to append `.old' to the next 50 words of text. Type

  C-x (
to start defining a macro, then perform what you want the macro to do on the first word,
  M-f .old
(M-f goes to the end of the current word) then end the macro definition using
  C-x )
C-x e will execute this, the last defined macro, once. To perform it 48 more times, use C-u 48 C-x e.

To give this macro a name, use

  M-x name-last-kbd-macro RET <macroname> RET
You can now use M-x <macroname> to call the macro, or use global-set-key to bind a key to the macro (see page gif).



Tim Love
Wed Jul 1 14:08:45 BST 1998