7

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?

KAction
  • 1,977
  • 15
  • 31
  • I believe they're the same. It's just a notational difference – Eric May 21 '13 at 19:25
  • 1
    It's ok to accept your own answer (click the checkmark beside your answer). This is also helpful for others, as it marks the question as 'answered'. – Tyler May 22 '13 at 15:48

1 Answers1

11

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).

Tyler
  • 9,872
  • 2
  • 33
  • 57
KAction
  • 1,977
  • 15
  • 31