From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#43830: keyboard layout handling incompatible with rest of the OS Date: Mon, 02 Nov 2020 17:38:22 +0200 Message-ID: <83d00vepld.fsf@gnu.org> References: <87h7r78a5y.fsf@mail.linkov.net> <87imbn2iwm.fsf@mail.linkov.net> <87y2kisawy.fsf@mail.linkov.net> <83362qa073.fsf@gnu.org> <87blhdrhww.fsf@mail.linkov.net> <83362p85l3.fsf@gnu.org> <83y2jqcrvn.fsf@gnu.org> <87blghbjpn.fsf@mail.linkov.net> <83blghf0rf.fsf@gnu.org> <83v9eoeuud.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="28426"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 43830@debbugs.gnu.org, pogonyshev@gmail.com, juri@linkov.net To: Arthur Miller Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Nov 02 16:39:09 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 1kZbvJ-0007Ja-M9 for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 02 Nov 2020 16:39:09 +0100 Original-Received: from localhost ([::1]:39732 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kZbvI-0004Td-Hh for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 02 Nov 2020 10:39:08 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:56798) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kZbvC-0004TP-0S for bug-gnu-emacs@gnu.org; Mon, 02 Nov 2020 10:39:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:58880) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kZbvB-0001pt-Mq for bug-gnu-emacs@gnu.org; Mon, 02 Nov 2020 10:39:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kZbvB-0003Dc-K2 for bug-gnu-emacs@gnu.org; Mon, 02 Nov 2020 10:39:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 02 Nov 2020 15:39:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 43830 X-GNU-PR-Package: emacs Original-Received: via spool by 43830-submit@debbugs.gnu.org id=B43830.160433153412356 (code B ref 43830); Mon, 02 Nov 2020 15:39:01 +0000 Original-Received: (at 43830) by debbugs.gnu.org; 2 Nov 2020 15:38:54 +0000 Original-Received: from localhost ([127.0.0.1]:42193 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kZbv3-0003DE-JY for submit@debbugs.gnu.org; Mon, 02 Nov 2020 10:38:53 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:56612) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kZbv2-0003D2-0L for 43830@debbugs.gnu.org; Mon, 02 Nov 2020 10:38:52 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:48415) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kZbuv-0001nS-6L; Mon, 02 Nov 2020 10:38:45 -0500 Original-Received: from [176.228.60.248] (port=1296 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1kZbui-0000WW-LE; Mon, 02 Nov 2020 10:38:36 -0500 In-Reply-To: (message from Arthur Miller on Mon, 02 Nov 2020 05:41:06 +0100) 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:192529 Archived-At: > From: Arthur Miller > Cc: Paul Pogonyshev , 43830@debbugs.gnu.org, > juri@linkov.net > Date: Mon, 02 Nov 2020 05:41:06 +0100 > > > Nothing else makes sense to me, because exposing this info to Lisp > > means every Lisp program which deals with input will have to decide > > what to do with such events. > > Couldn't Emacs just pack scancodes into some event structure That's what I was prfoposing to do, on the C level. > Would it be possible to use scancodes for the shortcuts internally in > the interpreter itself? I don't think I understand what shortcuts you have in mind here. > Shortcuts could be specified by users and scripts as they are now > (as keys/characters); but when Emacs starts, it could populate a lookup > table based on the current layout with scancodes, and then translate > shortcuts from keys to scancodes for internal usage. If user chagnes > keyboard layout on the fly, new lookup table would be generated, because > virtual keys would change but scancodes would stay same; so it wouldn't > matter if some key jumps from one physical key to another. That wouldn't > require to expose scancodes to Lisp either. But that would mean that > routines for inserting text in buffers would have to work differently > from shortcut handling routines, with regard to input; I don't know if > that is case now or if it is possible. > > Is something like that possible to implement in current Emacs? Woukd it > be too much work? I think you are forgetting how many different methods are there on a modern system to generate keyboard input. There are system input methods, there are virtual keyboards, etc. etc. And I don't think we can easily read keyboard on scancode level, either, even if we wanted to. But I'm not an expert. > I don't know if it is possible to automatically detect keyboard layout > change in all cases. AFAIK, we only support that on MS-Windows. > I know that Emacs automatically switches to different layout when I > change keyboard with loadkeys or in vconsole.conf. That's because we read characters, and those don't change.