I am just starting out in in Emacs. Sometimes I'll be experimenting with something and when I'm finished experimenting, I want to just go back to the buffer I was editing, but I don't know how. Worse, sometimes I hit a key by accident and don't even know what I hit! In Vim I can just hit ESC to recover; is there any similar way to recover in Emacs?
EDIT: I am using the command line (non-GUI) Emacs.
You may also write the contents of the buffer to a different file with the command Control-X-Control-W. Emacs will prompt you for the name of the file you want to create. To create a new file, use Control-X-Control-F, just as if the file already existed.
There's also ESC-ESC-ESC (keyboard-escape-quit). From the manual:
The command ESC ESC ESC (keyboard-escape-quit) can either quit or abort. This key was defined because ESC is used to "get out" in many PC programs. It can cancel a prefix argument, clear a selected region, or get out of a Query Replace, like C-g. It can get out of the minibuffer or a recursive edit, like C-]. It can also get out of splitting the frame into multiple windows, like C-x 1. One thing it cannot do, however, is stop a command that is running. That's because it executes as an ordinary command, and Emacs doesn't notice it until it is ready for a command.
I find pressing ESC to be a natural response to the desire to "exit" a situation. Hammering it several times can also be emotionally satisfying when you are frustrated.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With