(lispref.info)Keyboard Macros

Prev: Command History Up: Command Loop

Keyboard Macros

   A "keyboard macro" is a canned sequence of input events that can be
considered a command and made the definition of a key.  Don't confuse
keyboard macros with Lisp macros (Note: Macros.).

 - Function: execute-kbd-macro MACRO &optional COUNT
     This function executes MACRO as a sequence of events.  If MACRO is
     a string or vector, then the events in it are executed exactly as
     if they had been input by the user.  The sequence is *not*
     expected to be a single key sequence; normally a keyboard macro
     definition consists of several key sequences concatenated.

     If MACRO is a symbol, then its function definition is used in
     place of MACRO.  If that is another symbol, this process repeats.
     Eventually the result should be a string or vector.  If the result
     is not a symbol, string, or vector, an error is signaled.

     The argument COUNT is a repeat count; MACRO is executed that many
     times.  If COUNT is omitted or `nil', MACRO is executed once.  If
     it is 0, MACRO is executed over and over until it encounters an
     error or a failing search.

 - Variable: last-kbd-macro
     This variable is the definition of the most recently defined
     keyboard macro.  Its value is a string or vector, or `nil'.

 - Variable: executing-macro
     This variable contains the string or vector that defines the
     keyboard macro that is currently executing.  It is `nil' if no
     macro is currently executing.

 - Variable: defining-kbd-macro
     This variable indicates whether a keyboard macro is being defined.
     It is set to `t' by `start-kbd-macro', and `nil' by
     `end-kbd-macro'.  You can use this variable to make a command
     behave differently when run from a keyboard macro (perhaps
     indirectly by calling `interactive-p').  However, do not set this
     variable yourself.

   The commands are described in the user's manual (Note: Keyboard

automatically generated by info2www