all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* How to keep key bindings working after switching keyboard layout
@ 2016-01-24 12:41 Andrew Gaydenko
  2016-01-24 14:23 ` Yuri Khan
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Gaydenko @ 2016-01-24 12:41 UTC (permalink / raw)
  To: help-gnu-emacs

Hi!

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.

I have tried to find decision, but all I have found is very old and or
not working.

Emacs from the 25.x git branch is in use at the moment, but I'm ready to
switch to the last 24.x stable one.


Andrew




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How to keep key bindings working after switching keyboard layout
  2016-01-24 12:41 How to keep key bindings working after switching keyboard layout Andrew Gaydenko
@ 2016-01-24 14:23 ` Yuri Khan
  2016-01-24 14:33   ` Andrew Gaydenko
  2016-01-24 23:41   ` Emanuel Berg
  0 siblings, 2 replies; 4+ messages in thread
From: Yuri Khan @ 2016-01-24 14:23 UTC (permalink / raw)
  To: Andrew Gaydenko; +Cc: help-gnu-emacs@gnu.org

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.)



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How to keep key bindings working after switching keyboard layout
  2016-01-24 14:23 ` Yuri Khan
@ 2016-01-24 14:33   ` Andrew Gaydenko
  2016-01-24 23:41   ` Emanuel Berg
  1 sibling, 0 replies; 4+ messages in thread
From: Andrew Gaydenko @ 2016-01-24 14:33 UTC (permalink / raw)
  To: help-gnu-emacs

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




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How to keep key bindings working after switching keyboard layout
  2016-01-24 14:23 ` Yuri Khan
  2016-01-24 14:33   ` Andrew Gaydenko
@ 2016-01-24 23:41   ` Emanuel Berg
  1 sibling, 0 replies; 4+ messages in thread
From: Emanuel Berg @ 2016-01-24 23:41 UTC (permalink / raw)
  To: help-gnu-emacs

Yuri Khan <yuri.v.khan@gmail.com> writes:

> 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.

This can be remedied as well by bringing everything
into Emacs - which has many other advantages as well!

Some of the most rewarding/obvious examples are:

    Thunderbird -> Emacs Gnus
    Firefox     -> Emacs w3m
    Irssi       -> ERC
    man pages   -> M-x man

-- 
underground experts united
http://user.it.uu.se/~embe8573




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-01-24 23:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-24 12:41 How to keep key bindings working after switching keyboard layout Andrew Gaydenko
2016-01-24 14:23 ` Yuri Khan
2016-01-24 14:33   ` Andrew Gaydenko
2016-01-24 23:41   ` Emanuel Berg

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.