All Manuals > Editor User Guide > 3 Command Reference

3.28 Keyboard macros

Keyboard macros enable a sequence of commands to be turned into a single operation. For example, if it is found that a particular sequence of commands is to be repeated a large number of times, they can be turned into a keyboard macro, which may then be repeated the required number of times by using Prefix Arguments.

Note that keyboard macros are only available for use during the current editing session.

Define Keyboard Macro Editor Command

Arguments: None
Key sequence: Ctrl+X Shift+(

Begins the definition of a new keyboard macro. All the commands that are subsequently invoked are executed and at the same time combined into the newly defined macro. Any text typed into the buffer is also included in the macro. The definition is ended with End Keyboard Macro, and the sequence of commands can then be repeated with Last Keyboard Macro.

End Keyboard Macro Editor Command

Arguments: None
Key sequence: Ctrl+X Shift+)

Ends the definition of a keyboard macro.

Last Keyboard Macro Editor Command

Arguments: None
Key sequence: Ctrl+X E

Executes the last keyboard macro defined. A prefix argument causes the macro to be executed the required number of times.

Name Keyboard Macro Editor Command

Arguments: name
Key sequence: None

editor:name-keyboard-macro-command p &optional name

Makes the last defined keyboard macro into a command called name that can subsequently be invoked by means of Extended Command.

Keyboard Macro Query Editor Command

Arguments: action
Key sequence: Ctrl+X Q action

During the execution of a keyboard macro, this command prompts for an action. It is therefore possible to control the execution of keyboard macros while they are running, to a small extent.

The following actions can be used to control the current macro execution.

Space
Continue with this iteration of the keyboard macro and then proceed to the next.
Delete
Skip over the remainder of this iteration of the keyboard macro and proceed to the next.
Escape
Exit from this keyboard macro immediately.

Editor User Guide (Macintosh version) - 01 Dec 2021 19:35:09