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: Alexandre Garreau
Subject: Re: [External] : New key binding syntax
Date: Thu, 18 Nov 2021 22:13:20 +0100

Le jeudi 18 novembre 2021, 17:20:23 CET Yuri Khan a écrit :
> 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.

What do you mean? how does that concreticizes? how do you observe that?

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

I don’t believe it, and would expect very strong and concrete evidence for 
that.

> > 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.

That’s sad.

> > 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.

Yeah you would have to stop use xkb, and define only one X layout, that 
would be your most used latin layout, and start doing everything with 
emacs… that’s something I, too, have not yet started to do…

But please notice if you do Ctrl+ any letter that’s cyrillic or arabic in 
emacs, you get for instance C-ы or C-لا (I bound that last to C-g, because 
I find extremely beautiful that a language have a layout whose central key 
means “no”, so you can type “Ctrl+no”), nothing is stopping you from doing 
that.  Actually, if emacs really wanted to use mnemotechnic bindings in 
all circumstances, we should have some keymap for each script… but nobody 
is doing that, and I really think, too, that ideally we should bind 
commands to keycodes, not to keysyms, because it works best and more 
logically in a multilingual environment, and it would help move emacs into 
the direction of purely modal editing (such as what spacemacs succeedingly 
promotes)

> > > 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.

It’s not a primary layout, I suspect it’s only the “last used layout” 
that’s latin (possibly it could be dvorak, or parts of qwertz, azerty or 
bépo).  I strongly suspect this is a bug, and that working derives from 
some interaction nobody ever consciously designed

> So, why am I raising this in this thread? It Would Be Nice if Emacs
> some day let keymaps bind either Keys or Characters,

And Keys should be specified by number, that’s the only neutral, portable 
and long-term stable solution there

> 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.

I totally agree




reply via email to

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