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: Andrew Gaydenko
Subject: Re: How to keep key bindings working after switching keyboard layout
Date: Sun, 24 Jan 2016 17:33:52 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1

On 24.01.2016 17:23, Yuri Khan wrote:
> On Sun, Jan 24, 2016 at 6:41 PM, Andrew Gaydenko <a@gaydenko.com> 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.)


Yuri,

Thanks for the detailed and opened answer. I more tend to select the
last way, that is to form a brain to switch back to Latin. The brain in
hands isn't too young and, as a result, isn't too liquid.

But I'll try :)


Regards,
Andrew




reply via email to

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