[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Making ESC not a prefix key while keeping Alt = Meta
From: |
Kevin Rodgers |
Subject: |
Re: Making ESC not a prefix key while keeping Alt = Meta |
Date: |
Mon, 11 Sep 2006 09:20:02 -0600 |
User-agent: |
Thunderbird 1.5.0.5 (Windows/20060719) |
Yevgeniy Makarov wrote:
Kevin Rodgers wrote:
(global-set-key "\0" (global-key-binding "\e"))
(setq meta-prefix-char ?\0)
(global-unset-key "\e")
This indeed disassociates ESC from Alt; however, ESC remains a prefix
key. For example, when I press ESC, Emacs waits a little and then
displays "ESC-" in the minibuffer, waiting for the second key in the
sequence. A similar thing happens when I press C-h ESC (describe key
briefly).
Apparently some modes bind ESC locally e.g. lisp-interaction-mode
(*scratch) and help-mode (*Help*). So you'd need to put
(local-unset-key "\e") in each such mode's hook.
When I say
(global-set-key "\e" 'keyboard-quit)
this indeed puts keyboard-quit function in the global-keymap where
ESC-prefix used to be. However, ESC does not become a synonym for C-g:
for example, when I do C-x C-f (find file), I can't terminate input
using ESC.
From the Quitting node of the Emacs Lisp manual:
,----
| -- Command: keyboard-quit
| This function signals the `quit' condition with `(signal 'quit
| nil)'. This is the same thing that quitting does. (See `signal'
| in *Note Errors::.)
|
| You can specify a character other than `C-g' to use for quitting.
| See the function `set-input-mode' in *Note Terminal Input::.
`----
The first node under Terminal Input is Input Modes, which describes
the set-input-mode and current-input-mode functions. So:
(let ((input-mode (current-input-mode)))
(setcar (nthcdr 3 input-mode) ?\e) ; QUIT = ESC
(set-input-mode input-mode))
--
Kevin