Emacs Macros


Emacs is built on macros. Emacs gets its name from macros. E(xtensible)Mac(ro) editor. If you never used Emacs macros, time to start.

Macro usage in Emacs is pretty simple. Start macro record. Enter key sequence or combo. End macro record. Run the macro.

Start recording hit Ctrl-x (

Stop recording hit Ctrl-x )

Run macro hit Ctrl-x e

If you need to run the macro several times, try:

Ctrl-u 8 Ctrl-x e

Runs the macro 8 times. Ctrl u passes the number of iterations.

Wanna run the macro to the end of a buffer? Do:

Ctrl-u 0 Ctrl-x e (that's a zero)

You can bind macro start record, macro stop record, and macro execute to function keys, such as [F3] [F4] [F5]. If you want to execute the macro several times, its easy to press a single button.

You can bind macros to a single key. I'll update this later.