Frequently, I’ve dug into apropos and docs looking for something like the following only to give up to get back to the task at hand:
(repeat-last-command)
do the last C- or M- command I just executed (to be rebound to a fn key)
or sometimes the related:
(describe-last-function)
what keystroke did I just mistakenly issue, the effect of which I’d like to add to my bag of tricks. describe-key is close, but requires knowing what I typed.
Am I simply asking too much from my trusty sidekick?
with regards to ‘describe-last-function‘:
There’s a variable
last-commandwhich is set to a symbol representative of the last thing you did. So this elisp snippet –(describe-function last-command)– ought to bring up the documentation for the thing that immediately happened.So you could make a trivial working
describe-last-functionlike soPut that elisp in
.emacsor equivalent, and you’ll have a M-x describe-last-function.If you’ve banged on a few keys or done something that modified last-command since the thing you’re interested in, the
command-historyfunction might be of interest. You can get that by M-x command-history