unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Yuri Khan <yuri.v.khan@gmail.com>
To: Andrew Gaydenko <a@gaydenko.com>
Cc: "help-gnu-emacs@gnu.org" <help-gnu-emacs@gnu.org>
Subject: Re: How to keep key bindings working after switching keyboard layout
Date: Sun, 24 Jan 2016 20:23:51 +0600	[thread overview]
Message-ID: <CAP_d_8WVdGPRduhhkyV2onaKkEbuoXrMQXHZcJjXmNMk3DHfNQ@mail.gmail.com> (raw)
In-Reply-To: <56A4C66C.5070002@gaydenko.com>

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



  reply	other threads:[~2016-01-24 14:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-24 12:41 How to keep key bindings working after switching keyboard layout Andrew Gaydenko
2016-01-24 14:23 ` Yuri Khan [this message]
2016-01-24 14:33   ` Andrew Gaydenko
2016-01-24 23:41   ` Emanuel Berg

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_8WVdGPRduhhkyV2onaKkEbuoXrMQXHZcJjXmNMk3DHfNQ@mail.gmail.com \
    --to=yuri.v.khan@gmail.com \
    --cc=a@gaydenko.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.
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).