I guess everyone did it at some point: you press something accidentally, and something happens, and you don’t know what you have done, but it might be something stupid, or destructive, or smart. You press C-/
and you’ll never know what that was.
Well, don’t be so quick with undo, then. There are more options.
One is C-h l
, or M-x view-lossage
. It shows you the lat 300 keystrokes you pressed. (If you do this more often, you might also use M-x open-dribble-file
, which is basically an Emacs keylogger.)
But it also happens that you are not sure whether you accidentally deleted something, and C-h l
might not help with that. Then, you can M-x revert-buffer
; but before that, you may want to do M-x diff-buffer-with-file
. It does exactly what it says on the tin, and might come handy some day.