A keyboard macro is a command defined by the user to abbreviate a sequence of keys. For example, if you discover that you are about to type C-n C-d forty times, you can speed your work by defining a keyboard macro to invoke C-n C-d and calling it with a repeat count of forty.
Start defining a keyboard macro (
End the definition of a keyboard macro (
Execute the most recent keyboard macro (
Re-execute last keyboard macro, then add more keys to its definition.
When this point is reached during macro execution, ask for confirmation
Give a command name (for the duration of the session) to the most recently defined keyboard macro.
Insert in the buffer a keyboard macro’s definition, as Lisp code.
Keyboard macros differ from other Emacs commands in that they are written in the Emacs command language rather than in Lisp. This makes it easier for the novice to write them and makes them more convenient as temporary hacks. However, the Emacs command language is not powerful enough as a programming language to be useful for writing anything general or complex. For such things, Lisp must be used.
You define a keyboard macro by executing the commands which are its definition. Put differently, as you are defining a keyboard macro, the definition is being executed for the first time. This way, you see what the effects of your commands are, and don’t have to figure them out in your head. When you are finished, the keyboard macro is defined and also has been executed once. You can then execute the same set of commands again by invoking the macro.
|• Basic Kbd Macro:||Defining and running keyboard macros.|
|• Save Kbd Macro:||Giving keyboard macros names; saving them in files.|
|• Kbd Macro Query:||Keyboard macros that do different things each use.|