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

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

Re: Fwd: C-[ is undefined


From: Ben Bacarisse
Subject: Re: Fwd: C-[ is undefined
Date: Fri, 27 Jul 2018 17:19:15 +0100

John Shahid <jvshahid@gmail.com> writes:

> Ben Bacarisse <ben.lists@bsb.me.uk> writes:
>
>
> [...]
>
>>>>> Short story: ~C-x @ c [~ results in "C-[ is undefined" but I expected
>>>>> it to be the Meta prefix like in for example ~C-[ t~ for ~M-t~.
>>>>
>>>> I would expect C-x @ c [ to be the same as C-[
>>>
>>> Did you try? For me it is not the same which is what I wanted to say
>>> in the first place.
>>
>> Yes, I tried it, but my interpretation of the result ("C-[" is
>> undefined) was that C-x @ c [ was a way to generate a "key" that could
>> not otherwise be typed.
>>
>> That's kind of what happens.  For example, you can bind C-[ this way and
>> still use C-[ to get the ESC- prefix.
>>
>> However, that seems like an unlikely explanation!  It is probably
>> something to do with translated key sequences.  ESC and C-[ are not
>> exactly the same, but I am not expert enough to explain the way in which
>> they differ.
>
> I think there is an implicit assumption in this thread that Emacs is
> receiving key press events for both the 'Control' and '[' keys.  I tried
> this on my system using 'xev' and it receives a KeyPress event for
> 'Control' but as soon as I hit '[' the window receives a KeyPress event
> for Escape (i.e. '0x1b').  My conclusion is that Emacs doesn't even know
> that you pressed 'C-['.

Not here.  xev shows Control_L down, [ down, [ up, Control_l up.  Odd
difference.

> You can probably achieve the same result by translating 'C-[' to
> 'Escape' in the 'key-translation-map'.  This map is used after
> 'local-function-key-map' where the 'event-apply-control-modifier'
> applies the control modifier.  Another idea is to add an advice to
> 'event-apply-control-modifier'.

I thought it might be an interaction between translation maps and
others.

-- 
Ben.


reply via email to

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