From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Alexandre Garreau Newsgroups: gmane.emacs.devel Subject: Re: [External] : New key binding syntax Date: Thu, 18 Nov 2021 22:13:20 +0100 Message-ID: <12241038.6VuJXMZLlZ@galex-713.eu> References: <20211004081724.6281.11798@vcs0.savannah.gnu.org> <2280585.9P59HiE1Uh@galex-713.eu> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="39105"; mail-complaints-to="usenet@ciao.gmane.io" To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Nov 18 22:14:55 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mnokA-0009yZ-OE for ged-emacs-devel@m.gmane-mx.org; Thu, 18 Nov 2021 22:14:54 +0100 Original-Received: from localhost ([::1]:45824 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mnok9-0007CU-7f for ged-emacs-devel@m.gmane-mx.org; Thu, 18 Nov 2021 16:14:53 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:37020) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mnoj0-0006Pu-5D for emacs-devel@gnu.org; Thu, 18 Nov 2021 16:13:42 -0500 Original-Received: from [2a00:5884:8305::1] (port=52490 helo=galex-713.eu) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mnoiy-0003nJ-6C for emacs-devel@gnu.org; Thu, 18 Nov 2021 16:13:41 -0500 Original-Received: from gal by galex-713.eu with local (Exim 4.92) (envelope-from ) id 1mnoie-0001U6-QX for emacs-devel@gnu.org; Thu, 18 Nov 2021 22:13:20 +0100 In-Reply-To: X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:5884:8305::1 (failed) Received-SPF: pass client-ip=2a00:5884:8305::1; envelope-from=galex-713@galex-713.eu; helo=galex-713.eu X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) BAYES_00=-1.9, RDNS_NONE=0.793, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:279691 Archived-At: Le jeudi 18 novembre 2021, 17:20:23 CET Yuri Khan a =C3=A9crit : > On Thu, 18 Nov 2021 at 22:32, Alexandre Garreau = =20 wrote: > > > deal daily with layouts where pressing the key > > > Q yields the character =D0=B9. > >=20 > > Then it=E2=80=99s the key =D0=99, not the key Q. >=20 > No, it is the key Q. When I switch layouts, I don=E2=80=99t magically los= e 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 =E2=80=9Cmore basic=E2=80=9D or =E2=80=9Cmore = low level=E2=80=9D than =D0=99=D1=86=D1=83=D0=BA=D0=B5=D0=BD. >=20 > In a way, it is. I don=E2=80=99t believe it, and would expect very strong and concrete evide= nce for=20 that. > > What=E2=80=99s lower level are scancode > > (arbitrary numbers, depending of position on keyboard + whether it=E2= =80=99s > > pressed or released + history), translated to keycodes (not depending > > of whether it=E2=80=99s pressed or released, used by keymap layouts > > definitions), translated, by a given keyboard layout (be it US > > qwerty, US dvorak, programmer dvorak, standard russian =D0=B9=D1=86=D1= =83=D0=BA=D0=B5=D0=BD=D0=BF, > > polyglot reactionary =D0=B9=D1=86=D1=83=D0=BA=D0=B5=D0=BD (what I use),= french azerty, belgian > > azerty, french b=C3=A9po, german qwertz, swiss qwertz, etc.) to keysyms > > (which *are* characters, such as Q or =D0=99, 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=E2=80=99s sad. > > What about quail? > >=20 > > 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 >=20 > 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=E2=80=99d have to switch layouts with Ctrl+\ in Em= acs > but with a dedicated key everywhere else. Yeah you would have to stop use xkb, and define only one X layout, that=20 would be your most used latin layout, and start doing everything with=20 emacs=E2=80=A6 that=E2=80=99s something I, too, have not yet started to do= =E2=80=A6 But please notice if you do Ctrl+ any letter that=E2=80=99s cyrillic or ara= bic in=20 emacs, you get for instance C-=D1=8B or C-=D9=84=D8=A7 (I bound that last t= o C-g, because=20 I find extremely beautiful that a language have a layout whose central key= =20 means =E2=80=9Cno=E2=80=9D, so you can type =E2=80=9CCtrl+no=E2=80=9D), not= hing is stopping you from doing=20 that. Actually, if emacs really wanted to use mnemotechnic bindings in=20 all circumstances, we should have some keymap for each script=E2=80=A6 but = nobody=20 is doing that, and I really think, too, that ideally we should bind=20 commands to keycodes, not to keysyms, because it works best and more=20 logically in a multilingual environment, and it would help move emacs into= =20 the direction of purely modal editing (such as what spacemacs succeedingly= =20 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. > >=20 > > You cannot do that. There is no =E2=80=9Ckey Q=E2=80=9D independent fr= om a character, > > whatever the layout is. So [=E2=80=A6] you would have to > > *choose* manually one layout to take your key positions from, and > > translate keysyms to keycodes=E2=80=A6 which is pretty unusual and esot= eric, > > but could be done as well from a keymap layout definition (find yours > > in something such as /usr/share/X11/xkb/symbols/ru) >=20 > It=E2=80=99s 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 (=E2=80=98a=E2=80=99), and a= modifier > state with the Ctrl bit set. Clearly, something, somewhere, consults > the primary layout. It=E2=80=99s not a primary layout, I suspect it=E2=80=99s only the =E2=80= =9Clast used layout=E2=80=9D=20 that=E2=80=99s latin (possibly it could be dvorak, or parts of qwertz, azer= ty or=20 b=C3=A9po). I strongly suspect this is a bug, and that working derives fro= m=20 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=E2=80=99s the only neutral, po= rtable=20 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