From: Yuri Khan <yuri.v.khan@gmail.com>
To: "help-gnu-emacs@gnu.org" <help-gnu-emacs@gnu.org>
Subject: Re: Caps Lock affects Ctrl+keys
Date: Tue, 21 Jan 2014 03:38:58 +0700 [thread overview]
Message-ID: <CAP_d_8Vg+7Ko4skUm=gSqTNXDDwALmy2EEnewREUkUUE_NNOJQ@mail.gmail.com> (raw)
In-Reply-To: <CAP_d_8VuhwGUHEKeq=hvc+0dz+W0czpdgSREVSSiYRva3Rix3g@mail.gmail.com>
On Mon, Jan 20, 2014 at 6:57 PM, Yuri Khan <yuri.v.khan@gmail.com> wrote:
> I notice that, when I turn on Caps Lock, all Ctrl+letter combinations
> behave as if I pressed Ctrl+Shift+letter.
OK, I looked at the code.
In xterm.c, function handle_one_xevent, a KeyPress event is received,
with state == 0x06 (LockMask | ControlMask) and keycode == 52 (<AB01>
according to xkb/keycodes/evdev). Then, XmbLookupString is called on
this event, producing keysym == 0x5a ('Z') and storing a single 0x1a
character to copy_bufptr. The latter is ignored because the “if
(keysym >= 32 && keysym < 128)” branch is taken, producing an event
{kind: ASCII_KEYSTROKE_EVENT, code: 0x5a, modifiers: ctrl_modifier}.
The LockMask bit is lost at this point.
Then, under the “done:” label, the kbd_buffer_store_event_hold
function from keyboard.c is called, which in turn calls
make_ctrl_char, which sees 0x5a and sets the shift_modifier.
After this, no further processing, in Lisp or in C, can detect that
the Shift key was not in fact pressed.
The problem stems from the concept that keyboard input is a stream of
(extended) characters and any modifier keys just add modifier bits to
those characters. I do not think it can be fixed or worked around
without a significant rethinking of the input model.
This is unfortunate because, as a user, I expect Caps Lock to only
affect character input, not command bindings. As it is, turning on
Caps Lock upsets any key bindings that involve Shift. This includes
cua-mode’s C-x and C-c, and any user-defined bindings (in my case,
C-S-z = redo and C-S-u = insert-char).
Related: When I switch XKB groups (e.g. activate Russian layout), I
lose all C-letter and M-letter bindings, because they then produce
Cyrillic letters with the respective modifiers. E.g. with US English
QWERTY as primary and Russian ЙЦУКЕН as secondary, pressing Ctrl+W
produces C-ц instead of C-w. I work around this with an ugly
key-translation-map hack.
next prev parent reply other threads:[~2014-01-20 20:38 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-20 11:57 Caps Lock affects Ctrl+keys Yuri Khan
2014-01-20 14:47 ` Jude DaShiell
2014-01-20 15:24 ` Yuri Khan
2014-01-20 17:47 ` Jude DaShiell
[not found] ` <mailman.12433.1390240051.10748.help-gnu-emacs@gnu.org>
2014-01-20 18:24 ` Emanuel Berg
[not found] ` <mailman.12400.1390231499.10748.help-gnu-emacs@gnu.org>
2014-01-20 17:23 ` Emanuel Berg
2014-01-20 18:30 ` Yuri Khan
[not found] ` <mailman.12445.1390242632.10748.help-gnu-emacs@gnu.org>
2014-01-20 18:53 ` Emanuel Berg
2014-01-20 20:38 ` Yuri Khan [this message]
[not found] ` <mailman.12458.1390250342.10748.help-gnu-emacs@gnu.org>
2014-01-20 22:55 ` Emanuel Berg
2014-01-21 2:10 ` Emanuel Berg
2014-01-21 5:07 ` Yuri Khan
[not found] ` <mailman.12490.1390280831.10748.help-gnu-emacs@gnu.org>
2014-01-21 17:38 ` Emanuel Berg
2014-01-24 14:38 ` Yuri Khan
2014-01-24 15:56 ` Stefan Monnier
[not found] ` <mailman.12684.1390574300.10748.help-gnu-emacs@gnu.org>
2014-01-24 15:22 ` Dan Espen
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAP_d_8Vg+7Ko4skUm=gSqTNXDDwALmy2EEnewREUkUUE_NNOJQ@mail.gmail.com' \
--to=yuri.v.khan@gmail.com \
--cc=help-gnu-emacs@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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.