Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to bind ESC to keyboard-escape-quit in Emacs?

Tags:

Normally keyboard-escape-quit is bound to EscEscEsc. Is it possible to rebind it to a single Esc? I never use Escape as a prefix key.

I'm running Emacs 23.0.60.1 on Windows XP.

like image 444
Pavel Chuchuva Avatar asked Mar 15 '09 23:03

Pavel Chuchuva


People also ask

How do I rebind my Esc key?

You can find it under key bindings and the on foot tab, the vehicle tab, etc. Scroll down to you see it. click where it says menu and lists the keybinding as escape. You will be prompted to rebind it to a different key.

What is escaping on the keyboard?

Definition of Escape key a key (frequently labeled Esc) found on most computer keyboards and used for any of various functions, as to interrupt or cancel the current process or running program, or to close a pop-up window.


2 Answers

Rehashing other's answer, I have

(global-set-key (kbd "<escape>")      'keyboard-escape-quit)

in my .emacs file, and it works on my emacs 22 on WinXP. I also hate typing 3 ESC in a row; and from years of (windows) habits my finger goes so naturally to the escape key for getting out of anything unpleasant.

like image 166
polyglot Avatar answered Oct 05 '22 02:10

polyglot


Not to say this is right for you, but when I had this problem I taught myself to press Ctrl-g instead, which is also bound to keyboard-escape-quit by default. For me, this has the advantage of keeping my left hand pretty close to the home position, as well as leaving my Esc prefix intact.

Edit: After reading through the linked page, it's not bound to exactly the same function, and on Windows Ctrl-g can't forcibly interrupt a running command, but Ctrl-g covers 99% of what I would use Esc Esc Esc for --- aborting a command that I screwed up entering.

like image 43
Chris Connett Avatar answered Oct 05 '22 00:10

Chris Connett