HOWTO create keyboard macros in Emacs

You hear about the great macro feature of Emacs all the time. You see cheat sheets for Emacs key combinations all the time. But you never quite see the keyboard macro trick demonstrated clearly. Here's how it works:

You begin with "C-x (" - that's Control+X, then shift-9. The message buffer will say "Defining kbd macro..." Then you type in whatever series of keystrokes you will want to call with one keystroke. When you're done with the series, hit "C-x )" (open and close parenthesis, just like Lisp, get it?) and the message buffer will now say "Keyboard macro defined". Now you can call the macro at any time with "C-x e" and it will execute just like you typed it all in from scratch!

A real-world (set-up!) example:

Full Story.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Penguin Pete?

After that Tux500 libel, I think I'll keep that site on the mental bl[o|a]cklist. Eye-wink

Right With You

Yep--the guy has obliterated any credibility he had with me.