emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Ignoring keyboard modes for key chords


From: Yuri Khan
Subject: Ignoring keyboard modes for key chords
Date: Sun, 16 Oct 2016 12:45:52 +0600

Hello all,

I stumbled on a patch by Dima Kogan[^#24456] which partially fixes an
important usability bug. Namely, on some platforms and toolkits,
pressing C-s while Caps Lock is on produced C-S. That is, a persistent
mode (Caps Lock) affects the base character to which transient
modifiers (C-, M- and possibly s- and h-) are applied.

[^#24456]: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=24456

How can we generalize this to multiple keyboard layouts?


## Background

Users who need to enter text in more than one alphabet (e.g. Latin and
Cyrillic, or Latin and Greek, or Latin and Hebrew) use multiple
keyboard layouts. Typically, there is a small number of layouts (2 or
3) installed simultaneously; one of these is regarded as primary and
is the default layout that gets activated after login and possibly in
other circumstances. The user switches between installed layouts with
a special desktop-wide key binding, such as Ctrl+Shift, Alt+Shift, or
Cmd+Space. In this regard, a layout behaves as a persistent mode.


## Problem statement

On at least some platforms and toolkits (observed on
Gtk+/X11/GNU/Linux), pressing a key chord such as C-s while a
non-Latin keyboard layout is active produces an event with the correct
modifiers but the base character interpreted according to that layout.
For example:

    $ setxkbmap en,ru , grp:ctrl_shift_toggle
    $ emacs -Q
    Ctrl+Shift
    Ctrl+s
    ⇒ C-ы is undefined


## Expected behavior

The general expectation among users is that the base key in a chord
should be interpreted according to the installed Latin layout. In the
above example, Ctrl+s should produce C-s, even though the Russian
layout is active.

In case there are more than one Latin layout, the primary layout should be used.


## Non-solutions

This issue has been brought up in the past on Emacs lists. A common
suggestion is to use Emacs input methods, e.g. the C-\ binding. If one
is careful to only use that in Emacs and not the windowing system’s
facilities, the problem is avoided.

This is a non-solution because the user then faces increased cognitive
burden by having to remember to switch layouts differently in Emacs
and the rest of the system.


## Complications

1: I expect the problem manifests differently depending on the
operating system, windowing system, toolkit and possibly desktop
environment.

2: It may not be possible to confidently detect layout-based
reinterpretation after the fact. For example, using the above en,ru
example, pressing C-/ while the Russian layout is active will generate
a C-. event.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]