Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Emacs escape key

Currently, if I press C-h c, then trice press ESC key on keyboard I get result

ESC ESC ESC (translated from <escape> <escape> <escape>) runs the command keyboard-escape-quit

What the difference between ESC and <escape> and how can I use this difference to make more keybindings?

like image 261
KAction Avatar asked May 21 '13 19:05

KAction


People also ask

What is the M key in Emacs?

Summary of essential emacs commands In the list below, C- means "control key", M- means "meta key" (escape). For meta commands, press the meta key, then the other key. Thus M-f stands for the keyboard sequence "press meta key", " press f".

What is capital M in Emacs?

The M stands for the Meta key, which you can emulate on most keyboards by pressing the Esc key. For more information on Emacs keystroke naming conventions, see How keystrokes are denoted in Emacs.


1 Answers

Found solution in emacs mailing list archive:

The escape key usually is linked to the escape char, but the two are different. Under a tty, Emacs receives the exact same byte-sequence from the terminal if you type the escape key or if you type C-[ (both send the escape char).

Under a GUI, on the other hand, Emacs can distinguish the two, so under a GUI, the escape key doesn't send ?\e (aka ESC for kbd) but escape (aka <escape> for kbd) which is usually turned into a ?\e via function-key-map (i.e. only if there's no corresponding binding for the key sequence with escape).

Same thing happens with tab (i.e. TAB (aka C-i) vs tab) and return (i.e. RET (aka C-m) vs return).

like image 51
KAction Avatar answered Sep 22 '22 01:09

KAction