From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Yuri Khan Newsgroups: gmane.emacs.help Subject: Re: How to keep key bindings working after switching keyboard layout Date: Sun, 24 Jan 2016 20:23:51 +0600 Message-ID: References: <56A4C66C.5070002@gaydenko.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1453645467 4514 80.91.229.3 (24 Jan 2016 14:24:27 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 24 Jan 2016 14:24:27 +0000 (UTC) Cc: "help-gnu-emacs@gnu.org" To: Andrew Gaydenko Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Jan 24 15:24:26 2016 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1aNLab-0008V2-K0 for geh-help-gnu-emacs@m.gmane.org; Sun, 24 Jan 2016 15:24:25 +0100 Original-Received: from localhost ([::1]:60646 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aNLaa-0008EV-Vb for geh-help-gnu-emacs@m.gmane.org; Sun, 24 Jan 2016 09:24:24 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:42496) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aNLaP-0008E7-Kn for help-gnu-emacs@gnu.org; Sun, 24 Jan 2016 09:24:14 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aNLaO-0006Vz-IZ for help-gnu-emacs@gnu.org; Sun, 24 Jan 2016 09:24:13 -0500 Original-Received: from mail-lf0-x234.google.com ([2a00:1450:4010:c07::234]:35355) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aNLaO-0006Vo-Ae for help-gnu-emacs@gnu.org; Sun, 24 Jan 2016 09:24:12 -0500 Original-Received: by mail-lf0-x234.google.com with SMTP id c192so70918656lfe.2 for ; Sun, 24 Jan 2016 06:24:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type:content-transfer-encoding; bh=KDy2eSKc0wN+Oq2Z4L+TFXOxSTGPkle6pq2TVA/q/AQ=; b=zdTZuH5tp/naWnMVq97uYPAVeRSWheX8w6zKmAMxSumaucbtok13fpczVnvzZTxF6J V/SlchVmdah1R4Es0VTFH4CA/835BkXy+7USU97/fGZqXyhe0+qXsBLwrdAvQALr4VW5 XKHVhBX0phGVI/IHJjAfX9Psff+PnjG4YM+7EMrA1dYJxWQ9La7dUkt6VVwPUqR29HNo tdIofnk+cZWMD5kZiybiTqQdjDsGpnSfYPyu0tVORy2FKizVV6/A72g7aEhuh+Ph9CRx 6RroVbhooZlGSgbQsZHN8SELZZ4tppb9OX6mK2hnPWTND+F/XHp2aHdeeYR9OTi6Z/5K c9WA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=KDy2eSKc0wN+Oq2Z4L+TFXOxSTGPkle6pq2TVA/q/AQ=; b=BIDIeC944tZcvvMBx3c+eT1aPFs3jTIdNaDpFf/KB2i9FG4KhJNrJtCKunuAhak98n iMjG9F49fPWJdJethR2z/6fq4hE8gq/xd8tD7lDtHFMKyIH9zGPVk7LaMV2aXnIrYjyg 8tYv7DlJi5T/1Iudhf6cGSRqLI2yxD3p+eDYwlFWJkUAqCWM3oj7xvsI9MaEw+GTmGsn gavzO/RhBgoxr75U3MdskREzCAgN1zebEE+apEuS9N5JNA5mqeHDQJkGci5GxbI9T7D/ YXvZRWq80cgdwVudmupkrU8eI47fGf/oh2xOn9eWz8MadJqyOdiZuPjSWKIv64uQELef PLIA== X-Gm-Message-State: AG10YOT8jiIPXqE+cXz0LM7cf0y1Szgiss2SqZSRDU2F266zDGK4E4FXQJDi+V3b6vS6DUJA9ZOSBksf8Lt+JA== X-Received: by 10.25.149.21 with SMTP id x21mr4705456lfd.124.1453645451112; Sun, 24 Jan 2016 06:24:11 -0800 (PST) Original-Received: by 10.112.160.72 with HTTP; Sun, 24 Jan 2016 06:23:51 -0800 (PST) In-Reply-To: <56A4C66C.5070002@gaydenko.com> X-Google-Sender-Auth: pqcERyrrPwP7snbS0ZYOxmmyUZE X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:4010:c07::234 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:108832 Archived-At: On Sun, Jan 24, 2016 at 6:41 PM, Andrew Gaydenko 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=E2=80=99 input method mechanism, activated by command =E2=80=9Ctoggle-input-method=E2=80=9D. This= has the advantage that key bindings =E2=80=9Cjust work=E2=80=9D, 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 =E2=80=9Ckey-translation-map=E2=80=9D mappi= ngs from C-=D0=B9 to C-q, C-=D1=86 to C-w, C-=D1=83 to C-e, =E2=80=A6, and similarly= for M-=D0=B9, C-M-=D0=B9, and so on: (define-key key-translation-map (kbd "C-=D0=B9") (kbd "C-q")) (define-key key-translation-map (kbd "C-=D1=86") (kbd "C-w")) =E2=80=A6 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=E2=80=99t be translated; also, single-letter bindings (e.g. =E2=80=9Cg=E2=80=9D to refresh a Dired buffer) cannot be translated t= his 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.)