From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#45347: Feature request: key positions for shortcuts instead of letters in Emacs Date: Mon, 21 Dec 2020 10:41:28 +0200 Organization: LINKOV.NET Message-ID: <8735zzim9z.fsf@mail.linkov.net> References: <5701301608497271@mail.yandex.kz> Mime-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="3833"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) Cc: 45347@debbugs.gnu.org, Paul Pogonyshev To: =?UTF-8?Q?=D0=90=D0=BA=D0=B8=D0=BC=D0=B6=D0=B0=D0=BD_?= =?UTF-8?Q?=D0=95=D0=B4=D0=B8=D0=B3=D0=B5?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Dec 21 09:45:17 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1krGoe-0000rE-G3 for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 21 Dec 2020 09:45:16 +0100 Original-Received: from localhost ([::1]:46796 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1krGod-0001Ah-7f for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 21 Dec 2020 03:45:15 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:53360) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1krGoQ-00019o-Mv for bug-gnu-emacs@gnu.org; Mon, 21 Dec 2020 03:45:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:34684) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1krGoQ-0007Nw-Ee for bug-gnu-emacs@gnu.org; Mon, 21 Dec 2020 03:45:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1krGoQ-0001MW-BL for bug-gnu-emacs@gnu.org; Mon, 21 Dec 2020 03:45:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 21 Dec 2020 08:45:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 45347 X-GNU-PR-Package: emacs Original-Received: via spool by 45347-submit@debbugs.gnu.org id=B45347.16085402655153 (code B ref 45347); Mon, 21 Dec 2020 08:45:02 +0000 Original-Received: (at 45347) by debbugs.gnu.org; 21 Dec 2020 08:44:25 +0000 Original-Received: from localhost ([127.0.0.1]:46219 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1krGno-0001L1-TQ for submit@debbugs.gnu.org; Mon, 21 Dec 2020 03:44:25 -0500 Original-Received: from relay1-d.mail.gandi.net ([217.70.183.193]:48469) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1krGnm-0001Kk-G2; Mon, 21 Dec 2020 03:44:23 -0500 X-Originating-IP: 91.129.99.98 Original-Received: from mail.gandi.net (m91-129-99-98.cust.tele2.ee [91.129.99.98]) (Authenticated sender: juri@linkov.net) by relay1-d.mail.gandi.net (Postfix) with ESMTPSA id 51C81240009; Mon, 21 Dec 2020 08:44:13 +0000 (UTC) In-Reply-To: <5701301608497271@mail.yandex.kz> ("=?UTF-8?Q?=D0=90=D0=BA=D0=B8=D0=BC=D0=B6=D0=B0=D0=BD_?= =?UTF-8?Q?=D0=95=D0=B4=D0=B8=D0=B3=D0=B5?="'s message of "Mon, 21 Dec 2020 03:07:22 +0600") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:196527 Archived-At: merge 43830 45347 thanks Thanks for your request. Please see the recent discussion about this problem in https://debbugs.gnu.org/43830 The latest idea there was to add scancodes to the event structure. Then it should be possible to bind commands to scancodes, or at least to translate scancodes to Emacs keys. > Currently, to type (at least) Cyrillic other than English in Emacs, you can > switch your keyboard layout in X.Org to Russian or Ukrainian or any other > language that has Cyrillic lettters. However, keybindings don't work. If I > type "C-Æ" (Æ is on the home row, pinky finger), it does not register as > "C-a". A lot of people have to use packages like reverse-im.el to partially > fix the issue. It uses Quail maps for keyboard layouts. > > But reverse-im has lots of issues that can't be fixed without changing the > Emacs core. If you configure it to use russian-typewriter map, switch to > russian-typewriter layout in X.Org and type C-2 on it, it registers as C--, > because on the Russian Typewriter layout 2 is actually a hyphen. Emacs > doesn't know if it's a hyphen on the English layout or a hyphen on the > Russian layout. If you're using a not-so-popular language (such as Kazakh, > which is what I happen to use), you have to make a Quail map from scratch. > If you're typing in German, C-S-7 will undo instead of whatever C-S-7 does > in English. On German QWERTZ layout, the letter Z is in the same place as > Y, thus the user has to remember different positions for Z and Y, because > German has them swapped and it depends on the language currently chosen. > French people with AZERTY have this issue, too. If you're using English > Dvorak, all the letters in other languages will translate to English > QWERTY, and you have to make a Quail map for all languages so that they > translate to Dvorak. Shortcuts that use a single key (like C-x e or of > Evil/Viper-mode/Boon/etc) won't work, because a single key will turn into a > letter from an alternative alphabet. It affects everyone except people who > only know English. Some suffer heavily (like me, I use Kazakh, Russian and > English Dvorak), some suffer less ( > > In my opinion, if the user uses X.Org or Wayland, Emacs has to record key > positions instead of the letters that were input. X.Org has that, it's > called a keycode. If you start xev, type the Tilde key on Russian and > English, the keycode stays the same, although on Russian the letter typed > is ³ instead of the tilde. Thus, Ctrl+keycode101 will always be > Ctrl+keycode101, no matter the keyboard layout. All programs use this > method. However, it's not perfect. On QWERTY and Dvorak, the keycodes are > also the same. If we bind shortcuts to the keycodes only, all shortcuts on > Dvorak will turn into QWERTY. A solution for this is parsing the "setxkbmap > -query" command. It shows the languages (to the right of "layout" in the > output) and its variants (empty means the default for the language). For > example, English QWERTY and Russian Typewriter show this output: > > > > layout: us,ru > variant: ,typewriter > > English Dvorak and RussianTypewriter show this output: > > layout: us,ru > variant: dvorak,typewriter > > We should account for alternative keyboard layouts. > Some people make their own keyboard layout variants that are not shipped > with X.Org by default. I don't know how to deal with this, but all the > other programs have the correct shortcuts on the Russian layout if you make > your own variant... > > There are some modes that use a single keystroke without any modifiers as > shortcuts (like dired, Viper-mode, Evil-mode). If the command ran from a > single keystroke is not a self-insert-command, in my opinion, it should be > converted from other language letter to an English letter for compatibility > with these modes. > > There's a package called "key-chord.el". I don't know how to make it work, > honestly, but maybe we can make a new function that maps to keycodes > instead of letters, so that key-chord.el could write a simple patch that > uses them? > > We also should make it a separate mode, so that people who rely on that > behavior for custom shortcuts can turn it off.