1

I am trying to bind the ESC key to a custom elisp function,

(global-set-key (kbd "<escape>") 'my-local-mode)

which works under X but does not when emacs is running in a termial. ESC acts as META. However I have tried evil mode and it is able to capture ESC (single ESC not M-ESC ESC). However digging thorugh the code I can not figure out where/how they did it. describe-key doesn't work. How can I bind single ESC press to call my function?

Drew
  • 29,895
  • 7
  • 74
  • 104
Hamza Yerlikaya
  • 49,047
  • 44
  • 147
  • 241

1 Answers1

0

The behavior seems fairly involved as it is in the core of emacs to have this translation: http://www.gnu.org/software/emacs/manual/html_node/elisp/Prefix-Keys.html

The behavior in evil happens in the following file: http://gitorious.org/evil/evil/blobs/master/evil-core.el

Nicolas Dudebout
  • 9,172
  • 2
  • 34
  • 43