bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#12868: global keymap preceeds input-decode-map


From: Stefan Monnier
Subject: bug#12868: global keymap preceeds input-decode-map
Date: Mon, 12 Nov 2012 12:03:04 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

> I understand, and agree that a timeout is a bad idea.  This should be
> reflected in the manual though, just as it is for local-function-key-map
> ("Entries in local-function-key-map are ignored if they conflict with
> bindings made in the minor mode, local, or global keymaps").

I find it difficult to describe in a precise way without being
too detailed, but I'll see what I can come up with.

> Maybe it should also point out the consequences of binding escape
> sequences used as prefix for common function keys, i.e. `ESC [' and
> `ESC O'.  One could even consider to unable colliding bindings to
> emphasize that you have to choose, rather than 'bugging out' silently.

Can you expand on what you mean by "unable colliding bindings".  Do you
mean that in your test case, Emacs should signal an error or at issue
a warning, after seeing the M-O?

Note that such colliding bindings already exist in the default config:
"emacs -nw -Q" and then ESC ESC ESC will run keyboard-escape-quit even
though the last ESC is a prefix of many function key escape sequences.

> BTW, the manual states that "The intent of key-translation-map is for users
> to map one character set to another, including ordinary characters normally
> bound to self-insert-command."
> Does this mean that key-translation-map is the recommended way to
> implement different layouts such as Colemak/Dvorak etc at the lowest
> possible level?

No, I don't think so.  But to tell you the truth, I do not know
understand the reasoning behind key-translation-map.

Also, I don't think there is a "recommended way" to provide such
a remapping within Emacs, currently.  Or rather than recommended way is
probably to do the remapping outside of Emacs.

> If yes, in the case of remapping `o' to `y' (Colemak example), M-O would
> never get through the input-decode-map filter and therefore never pop up to
> key-translation-map in order to produce M-Y. Is that correct?

Yes, that's right.

> /Stefan

> On 12 nov 2012, at 15:32, Stefan Monnier wrote:

>>> emacs -nw -Q
>>> (defun foo () (interactive) (message "foo"))
>>> (global-set-key "\M-O" 'foo)
>> [...]
>>> Arrow keys now inserts A,B,C,D in buffer.
>> [...]
>>> Arrow keys sends M-O A (up), M-O B (down) etc. These should be
>>> translated to function keys <up>, <down> etc in input-decode-map
>>> before any key lookup.  Somehow, the binding of M-O in the global
>>> keymap takes precedence.
>> 
>> Indeed, thanks for bringing this up.  The cause for the bug is that the
>> rule for what goes first and what goes next is here ignored because we
>> stop waiting for more input as soon as a real binding is found
>> (i.e. right after M-O).
>> 
>> The predicate that decides when to stop waiting for more input would
>> need to say say "don't stop if we're in the middle of a potential
>> input-decode-map rewrite".  But then if you want to run `foo', you'd
>> have the problem that after hitting M-O, Emacs will not actually run
>> `foo' but will sit there waiting to see if the next key is one of
>> [ABCD].
>> 
>> The only way to get our cake and eat it too would be to use some kind of
>> timeout, which we have resisted so far.
>> 
>> 
>> Stefan





reply via email to

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