From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Yuri Khan Newsgroups: gmane.emacs.devel Subject: Re: [External] : New key binding syntax Date: Thu, 18 Nov 2021 23:20:23 +0700 Message-ID: References: <20211004081724.6281.11798@vcs0.savannah.gnu.org> <4371985.yOQEpiRy8s@galex-713.eu> <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="15351"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Drew Adams , Stefan Kangas , Richard Stallman , Emacs developers To: Alexandre Garreau Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Nov 18 17:21: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 1mnkAd-0003n2-5H for ged-emacs-devel@m.gmane-mx.org; Thu, 18 Nov 2021 17:21:55 +0100 Original-Received: from localhost ([::1]:47468 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mnkAb-0004NS-SK for ged-emacs-devel@m.gmane-mx.org; Thu, 18 Nov 2021 11:21:53 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:52718) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mnk9R-0003N4-0L for emacs-devel@gnu.org; Thu, 18 Nov 2021 11:20:41 -0500 Original-Received: from [2607:f8b0:4864:20::92b] (port=39754 helo=mail-ua1-x92b.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mnk9N-0005gI-UZ; Thu, 18 Nov 2021 11:20:40 -0500 Original-Received: by mail-ua1-x92b.google.com with SMTP id i6so14873804uae.6; Thu, 18 Nov 2021 08:20:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=Gt6N2nD2NmdnzZdfplbJKqIfYbPJYc1iw4LvzQodNsU=; b=ggkE+RQ8o2IZh1Nxdgi5FtjPrWbpWYnXjH8mJLWHhVwURcqUl0DHID9WEncst/8061 LlnO+BLJFEgKnM/MImMEXCbWfNZIi3PGhogvZ2luNLoDoKSwZVJFzvjvSU6oih7BNcK7 uGuojM6smjpzWQa/tJPxpcC73n+/mP4SBCw2z7Ah+PhIHIfpXfYmGXoD6H94+3KbbS6L 8Tp8nBCiCf8gv5IXZ2vtoCWytTgPbisgr7JGsbKT0cg20fBVTmTKWcpa9AamxTh0vKd0 bRIZilFXRZNmENxTSnU2Oqt7/i42Xkkce80XX76k7Dw9AhGqu5Kq9Hd7EOOa42dNPQ30 pTbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=Gt6N2nD2NmdnzZdfplbJKqIfYbPJYc1iw4LvzQodNsU=; b=g7fFe4b+NR7nUychFBDefpzFqZ+j9nMs5mi0+D26mQm+4JICzTH8L0K1HQ9TckKifl vSpi3O87bBTr4HKCM6PBsm9PpSsxLh+yMSHgCYFQsM7H1ED8JLWjUdkrxM4NL3byT3+k r/DjFKKuKNmI6EXLBZGlUnJbPKxEHRMf3vOXfvHqWV+2wl6zD0FLB6DwTgbZINNWElW9 7MO7v7sW3Fkq55707Gc1I1CIkqe7hQKtNV5JfSaYz0MZXU98nGf3ts5t20QeyAZcYrnN fLeXqrypPa74v7F029Vxo9tEtqapCB20VVU7UDCLBKx9cOZ3JxVOdsZnjuhTBzXuDhxS 25pw== X-Gm-Message-State: AOAM5334vNwXD95oLiD1jDlF9vA0UtQKldDpCGKoL2h1921XHPQhFa3Q 1PUi5UhdI8uwPnu+CLRL5V6+Lk/gOqpeiTYlJms= X-Google-Smtp-Source: ABdhPJy154ZXc699AWYlpKr6vevgwDBi1FjdNmsH38/OdCchkTRN5f5HFbOWvRqAiPRpEYl3ueykUSfK1l30aen/Srk= X-Received: by 2002:a67:1c05:: with SMTP id c5mr83691656vsc.25.1637252435285; Thu, 18 Nov 2021 08:20:35 -0800 (PST) In-Reply-To: <2280585.9P59HiE1Uh@galex-713.eu> X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::92b (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::92b; envelope-from=yurivkhan@gmail.com; helo=mail-ua1-x92b.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, PDS_HP_HELO_NORDNS=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=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:279683 Archived-At: On Thu, 18 Nov 2021 at 22:32, Alexandre Garreau wr= ote: > > deal daily with layouts where pressing the key > > Q yields the character =D0=B9. > > Then it=E2=80=99s the key =D0=99, not the key Q. No, it is the key Q. When I switch layouts, I don=E2=80=99t 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 =E2=80=9Cmore basic=E2=80=9D or =E2=80=9Cmore lo= w level=E2=80=9D than =D0=99=D1=86=D1=83=D0=BA=D0=B5=D0=BD. In a way, it is. > 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 definiti= ons), > 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 qwe= rtz, > 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. > 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=E2=80=99d have to switch layouts with Ctrl+\ in Emac= s 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 =E2=80=9Ckey Q=E2=80=9D independent from= 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 esoter= ic, but > could be done as well from a keymap layout definition (find yours in > something such as /usr/share/X11/xkb/symbols/ru) 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 m= odifier 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.