GNU bug report logs - #43830
keyboard layout handling incompatible with rest of the OS

Previous Next

Package: emacs;

Reported by: Paul Pogonyshev <pogonyshev <at> gmail.com>

Date: Tue, 6 Oct 2020 15:35:01 UTC

Severity: normal

Merged with 45347, 49379

Found in version 27.1

Full log


Message #107 received at 43830 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Arthur Miller <arthur.miller <at> live.com>
Cc: 43830 <at> debbugs.gnu.org, pogonyshev <at> gmail.com, juri <at> linkov.net
Subject: Re: bug#43830: keyboard layout handling incompatible with rest of
 the OS
Date: Mon, 02 Nov 2020 17:38:22 +0200
> From: Arthur Miller <arthur.miller <at> live.com>
> Cc: Paul Pogonyshev <pogonyshev <at> gmail.com>,  43830 <at> debbugs.gnu.org,
>   juri <at> 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.




This bug report was last modified 3 years and 346 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.