* Making ESC not a prefix key while keeping Alt = Meta
@ 2006-09-08 20:49 Yevgeniy Makarov
2006-09-09 14:49 ` Kevin Rodgers
[not found] ` <mailman.6687.1157813407.9609.help-gnu-emacs@gnu.org>
0 siblings, 2 replies; 5+ messages in thread
From: Yevgeniy Makarov @ 2006-09-08 20:49 UTC (permalink / raw)
Since in my Emacs Alt key functions as Meta key, I never have to use
Esc to enter Meta-something. Though this breaks with the long-lasting
Emacs tradition, I would like to make ESC key call keyboard-quit
function, similar to Ctrl-g. Of course, I'd like to keep Alt = Meta. Is
it possible to do so?
I am using Linux and GNU Emacs 21.3.1.
Thank you.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Making ESC not a prefix key while keeping Alt = Meta
2006-09-08 20:49 Making ESC not a prefix key while keeping Alt = Meta Yevgeniy Makarov
@ 2006-09-09 14:49 ` Kevin Rodgers
[not found] ` <mailman.6687.1157813407.9609.help-gnu-emacs@gnu.org>
1 sibling, 0 replies; 5+ messages in thread
From: Kevin Rodgers @ 2006-09-09 14:49 UTC (permalink / raw)
Yevgeniy Makarov wrote:
> Since in my Emacs Alt key functions as Meta key, I never have to use
> Esc to enter Meta-something. Though this breaks with the long-lasting
> Emacs tradition, I would like to make ESC key call keyboard-quit
> function, similar to Ctrl-g. Of course, I'd like to keep Alt = Meta. Is
> it possible to do so?
I think so:
(global-set-key "\0" (global-key-binding "\e"))
(setq meta-prefix-char ?\0)
(global-unset-key "\e")
--
Kevin
^ permalink raw reply [flat|nested] 5+ messages in thread
[parent not found: <mailman.6687.1157813407.9609.help-gnu-emacs@gnu.org>]
* Re: Making ESC not a prefix key while keeping Alt = Meta
[not found] ` <mailman.6687.1157813407.9609.help-gnu-emacs@gnu.org>
@ 2006-09-10 1:24 ` Yevgeniy Makarov
2006-09-11 15:20 ` Kevin Rodgers
[not found] ` <mailman.6777.1157988085.9609.help-gnu-emacs@gnu.org>
0 siblings, 2 replies; 5+ messages in thread
From: Yevgeniy Makarov @ 2006-09-10 1:24 UTC (permalink / raw)
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).
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.
Yevgeniy
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Making ESC not a prefix key while keeping Alt = Meta
2006-09-10 1:24 ` Yevgeniy Makarov
@ 2006-09-11 15:20 ` Kevin Rodgers
[not found] ` <mailman.6777.1157988085.9609.help-gnu-emacs@gnu.org>
1 sibling, 0 replies; 5+ messages in thread
From: Kevin Rodgers @ 2006-09-11 15:20 UTC (permalink / raw)
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
^ permalink raw reply [flat|nested] 5+ messages in thread
[parent not found: <mailman.6777.1157988085.9609.help-gnu-emacs@gnu.org>]
* Re: Making ESC not a prefix key while keeping Alt = Meta
[not found] ` <mailman.6777.1157988085.9609.help-gnu-emacs@gnu.org>
@ 2006-09-12 2:36 ` Yevgeniy Makarov
0 siblings, 0 replies; 5+ messages in thread
From: Yevgeniy Makarov @ 2006-09-12 2:36 UTC (permalink / raw)
> 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.
You are right. The local keymap for *scratch* buffer defined ESC. After
I unset it, I ran
(key-binding "\e")
and the answer was nil.
After that, I entered
> (let ((input-mode (current-input-mode)))
> (setcar (nthcdr 3 input-mode) ?\e) ; QUIT = ESC
> (set-input-mode input-mode))
replacing (set-input-mode input-mode) with (apply 'set-input-mode
input-mode), but pressing ESC when the minibuffer is active (e.g.,
during entering a filename) still has no effect. After I said
(global-set-key "\e" 'keyboard-quit)
pressing ESC in the scratch buffer causes the word "Quit" to appear in
the minibuffer, but pressing ESC in the minibuffer still has no effect.
Yevgeniy
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2006-09-12 2:36 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-09-08 20:49 Making ESC not a prefix key while keeping Alt = Meta Yevgeniy Makarov
2006-09-09 14:49 ` Kevin Rodgers
[not found] ` <mailman.6687.1157813407.9609.help-gnu-emacs@gnu.org>
2006-09-10 1:24 ` Yevgeniy Makarov
2006-09-11 15:20 ` Kevin Rodgers
[not found] ` <mailman.6777.1157988085.9609.help-gnu-emacs@gnu.org>
2006-09-12 2:36 ` Yevgeniy Makarov
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.