Variable: last-command
last-command is a variable defined in keyboard.c.
Value
nil
Documentation
The last command executed.
Normally a symbol with a function definition, but can be whatever was found
in the keymap, or whatever the variable this-command was set to by that
command.
The value mode-exit is special; it means that the previous command
read an event that told it to exit, and it did so and unread that event.
In other words, the present command is the event that made the previous
command exit.
The value kill-region is special; it means that the previous command
was a kill command.
last-command has a separate binding for each terminal device.
See Info node (elisp)Multiple Terminals.
Probably introduced at or before Emacs version 19.23.
Source Code
// Defined in /usr/src/emacs/src/keyboard.c
DEFVAR_KBOARD ("last-command", Vlast_command,
doc: /* The last command executed.
Normally a symbol with a function definition, but can be whatever was found
in the keymap, or whatever the variable `this-command' was set to by that
command.
The value `mode-exit' is special; it means that the previous command
read an event that told it to exit, and it did so and unread that event.
In other words, the present command is the event that made the previous
command exit.
The value `kill-region' is special; it means that the previous command
was a kill command.
`last-command' has a separate binding for each terminal device.
See Info node `(elisp)Multiple Terminals'. */);