next up previous contents
Next: Keyboard Shortcuts Up: Customizing your Environment Previous: Customizing your Environment   Contents


Macros

Macros are a great way to take the burden out of repetitive, annoying tasks. As mentioned above, the ``mac'' in emacs stands for ``macros'' and it's something emacs does very well. Simply hit C-x ( to begin recording a macro, and C-x ) when you're done. The status bar at the bottom of the screen will read ``defining keyboard macro'' as you type. Once the keyboard macro has been defined, it's an easy matter to invoke that macro throughout your typing session by typing C-x e and to re-invoke it by just striking e again as necessary. Or you can select a region and use M-x apply-macro-to-region-lines to edit only a certain portion of your text with the macro (C-x C-k r).

If you want to keep the macro available to you, save it and give it a name: Type M-x name-last-kbd-macro or C-x C-k n. You can edit that same macro by typing M-x edit-kbd-macro. A new buffer will open with the commands that make up your macro for editing.



Randall Wood 2011-03-31