help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: How to keep key bindings working after switching keyboard layout


From: Yuri Khan
Subject: Re: How to keep key bindings working after switching keyboard layout
Date: Sun, 24 Jan 2016 20:23:51 +0600

On Sun, Jan 24, 2016 at 6:41 PM, Andrew Gaydenko <address@hidden> wrote:

> How to keep key bindings working after switching keyboard layout?
> Saying "layout" I mean Linux workstation running X11 and having also got
> an alternative-to-Latin keyboard layout configured in X11 conf files.

This is an unsolved problem, and, to my knowledge, it cannot be solved
without a thorough rethinking of the Emacs input system. Workarounds
exist but are cumbersome, unreliable, inconvenient, or any combination
of the above.

Some people here will suggest that you use Emacs’ input method
mechanism, activated by command “toggle-input-method”. This has the
advantage that key bindings “just work”, but now you have a different
layout switching key and a different set of layouts in Emacs than the
rest of your desktop. Additionally, if your Latin layout is anything
other than US QWERTY, then your Cyrillic layout is pretty much hosed.

Another workaround is to add to “key-translation-map” mappings from
C-й to C-q, C-ц to C-w, C-у to C-e, …, and similarly for M-й, C-M-й,
and so on:

    (define-key key-translation-map (kbd "C-й") (kbd "C-q"))
    (define-key key-translation-map (kbd "C-ц") (kbd "C-w"))
    …

This way, you get to use your familiar X11 keyboard layout switching,
but only some of the bindings work. Notably, bindings that involve the
period and comma won’t be translated; also, single-letter bindings
(e.g. “g” to refresh a Dired buffer) cannot be translated this way.

Lastly, you can accept the status quo and condition yourself to always
switch back to Latin every time you need to invoke any command other
than self-insert-command or basic navigation. (For commands invoked
through M-x, you will have to do that anyway.)



reply via email to

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