emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Escape key as C-g


From: Stephen J. Turnbull
Subject: Escape key as C-g
Date: Tue, 05 Aug 2014 10:03:46 +0900

Craig Muth writes:

 > Regarding making the Escape key behave like C-g, this seems to work
 > fine in GUI emacs, but not terminal emacs:
 > 
 >   (define-key key-translation-map "\e" (kbd "C-g"))
 > 
 > Anyone know of some sort of settings change or other I could make to
 > get this to work in emacs running in a terminal?

There aren't any, if your definition of "work" includes "doesn't break
the function keys, the arrow keys, and pretty much everything that
isn't an ASCII character or control function".  (That last is an
exaggeration, but the breakage will indeed be widespread.)

The difference with the GUI is that in a GUI, Emacs has direct (well,
OS-level) access to the keyboard.  In TTY mode, on the other hand,
Emacs does not have access to the keyboard.  It has an input stream of
octets which may be generated by a keyboard, and conventionally all
but a few functions (basically, BEL, TAB, CR, LF, and ESC) are
represented by control sequences, which are introduced by ASCII ESC.

So, ironically, you could have almost any other key (preferably one
represented by a single octet), but ESC is off limits.

If you have a programmable terminal (Linux console, xterm), why not
just have the terminal send C-g when you stroke ESC?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]