emacs-devel
[Top][All Lists]
Advanced

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

Re: [External] : New key binding syntax


From: Yuri Khan
Subject: Re: [External] : New key binding syntax
Date: Thu, 18 Nov 2021 23:20:23 +0700

On Thu, 18 Nov 2021 at 22:32, Alexandre Garreau <galex-713@galex-713.eu> wrote:

> > deal daily with layouts where pressing the key
> > Q yields the character й.
>
> Then it’s the key Й, not the key Q.

No, it is the key Q. When I switch layouts, I don’t magically lose 33
keys, gain 33 different keys, and have a few other keys move around.
The comma key stays at AB08 even though the comma character is on
Shift+AB10.

> Qwerty is not in any way “more basic” or “more low level” than Йцукен.

In a way, it is.

> What’s lower level are scancode
> (arbitrary numbers, depending of position on keyboard + whether it’s
> pressed or released + history), translated to keycodes (not depending of
> whether it’s pressed or released, used by keymap layouts definitions),
> translated, by a given keyboard layout (be it US qwerty, US dvorak,
> programmer dvorak, standard russian йцукенп, polyglot reactionary йцукен
> (what I use), french azerty, belgian azerty, french bépo, german qwertz,
> swiss qwertz, etc.) to keysyms (which *are* characters, such as Q or Й,
> most of the time, but also can be other actions such as XF86AudioPlay)

I know all that. Still, in a dual-script environment, Latin is the
primary script and people use that when referring to a key.

> What about quail?
>
> Imho, when you are too often used to use a non-latin layout, using an
> input-method may be useful, as these will translate keys to write text,
> but not to enter keybindings

Quail is a solution if Emacs is your desktop environment. For me,
Emacs is an application, and I use XKB to handle layouts. Using Emacs
input methods in Emacs but XKB on the rest of the desktop would break
my muscle memory, as I’d have to switch layouts with Ctrl+\ in Emacs
but with a dedicated key everywhere else.

> > In an ideal
> > world, Dired would bind not the character q but the key Q, and it
> > would just work no matter the layout.
>
> You cannot do that.  There is no “key Q” independent from a character,
> whatever the layout is.  So […] you would have to
> *choose* manually one layout to take your key positions from, and
> translate keysyms to keycodes… which is pretty unusual and esoteric, but
> could be done as well from a keymap layout definition (find yours in
> something such as /usr/share/X11/xkb/symbols/ru)

It’s not unusual and not esoteric. When I press Ctrl+A with the
ru(winkeys) layout active, I get an X KeyPress event with a keycode of
38 (corresponding to AC01), a keysym of 0x61 (‘a’), and a modifier
state with the Ctrl bit set. Clearly, something, somewhere, consults
the primary layout.


So, why am I raising this in this thread? It Would Be Nice if Emacs
some day let keymaps bind either Keys or Characters, whichever makes
more sense for each binding. And while we are discussing a key binding
syntax for the next 20 years, It Would Be Nice if this syntax
permitted extension in that direction when the time comes.



reply via email to

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