Emacs Macros

Faster Than A Speeding Bullet

If you use Emacs but haven't tried macros, you are missing a fast powerful tool. Emacs macros are dead easy to use. Start record. Stop record. Run macro. Its that easy.

For executing repetitive tasks, macros are a big time saver.

To start a macro record, hit 'Ctrl-x (' and type what ever action you want.

Ctrl-x (

M-x start-kbd-macro

To stop a macro record, hit 'Ctrl-x )' then you can run the macro.

Ctrl-x )

M-x start-kbd-macro

To run the last recorded macro, hit 'Ctrl-x e'.

Ctrl-x e

M-x call-last-kbd-macro

To save the macro for future use, do:

M-x name-last-kbd-macro

Give the macro a name, then if you want to run the macro again, do:

M-x macroname

You need to plan a little before you record the macro. The macro action doesn't always go the way you want. Take it on a test run and evaluate results. If the macro is not doing what you expected,  re-record it with adjustments.

If you're planning on running the macro several times, you can use, repeat last action.