unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Yuri Khan <yuri.v.khan@gmail.com>
To: Emacs developers <emacs-devel@gnu.org>
Subject: Ignoring keyboard modes for key chords
Date: Sun, 16 Oct 2016 12:45:52 +0600	[thread overview]
Message-ID: <CAP_d_8Wx0wQ-6YGJpZxBxhm8cDReE1rdKibyLz2op5Fi0y8VBw@mail.gmail.com> (raw)

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	other threads:[~2016-10-16  6:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-16  6:45 Yuri Khan [this message]
2016-10-16  7:09 ` Ignoring keyboard modes for key chords Eli Zaretskii
2016-10-16  8:52   ` Yuri Khan
2016-10-16 10:12     ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAP_d_8Wx0wQ-6YGJpZxBxhm8cDReE1rdKibyLz2op5Fi0y8VBw@mail.gmail.com \
    --to=yuri.v.khan@gmail.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).