- Use C-x ( to start the macro (start recording keystrokes)
- …Perform whatever keyboard actions…
- Use C-x ) to stop the macro (stop recording keystrokes)
- Playback the recorded macro anytime using C-x e
You can also assign different hot-keys for convenience:
(global-set-key [f1] 'start-kbd-macro) (global-set-key [f2] 'end-kbd-macro) (global-set-key [f3] 'call-last-kbd-macro)
Check out the KeyboardMacros Emacs Wiki page for more in-depth info on Emacs Keyboard Macros.