From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andrew Gaydenko Newsgroups: gmane.emacs.help Subject: Re: How to keep key bindings working after switching keyboard layout Date: Sun, 24 Jan 2016 17:33:52 +0300 Message-ID: <56A4E0D0.80500@gaydenko.com> 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 1453646061 13276 80.91.229.3 (24 Jan 2016 14:34:21 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 24 Jan 2016 14:34:21 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Jan 24 15:34:12 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 1aNLk3-00053L-A4 for geh-help-gnu-emacs@m.gmane.org; Sun, 24 Jan 2016 15:34:11 +0100 Original-Received: from localhost ([::1]:60658 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aNLk2-0002o4-EC for geh-help-gnu-emacs@m.gmane.org; Sun, 24 Jan 2016 09:34:10 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:46037) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aNLjr-0002n6-9w for help-gnu-emacs@gnu.org; Sun, 24 Jan 2016 09:34:00 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aNLjo-0000gr-2M for help-gnu-emacs@gnu.org; Sun, 24 Jan 2016 09:33:59 -0500 Original-Received: from hga2.hostingcenter.ru ([81.177.18.4]:38219 helo=hga.hostingcenter.ru) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aNLjn-0000fv-N7 for help-gnu-emacs@gnu.org; Sun, 24 Jan 2016 09:33:55 -0500 Original-Received: from anli.goldspace.net (46-173-36-5.gorcom.ru [46.173.36.5] (may be forged)) (authenticated bits=0) by hga.hostingcenter.ru (8.14.4/8.14.0) with ESMTP id u0OEXrTp029138 for ; Sun, 24 Jan 2016 17:33:54 +0300 Original-Received: from [127.0.0.1] (localhost.localdomain [127.0.0.1]) by anli.goldspace.net (Postfix) with ESMTP id AC2A59FC9F for ; Sun, 24 Jan 2016 17:33:52 +0300 (MSK) X-Enigmail-Draft-Status: N1110 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 In-Reply-To: X-MIME-Autoconverted: from 8bit to quoted-printable by hga.hostingcenter.ru id u0OEXrTp029138 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x X-Received-From: 81.177.18.4 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:108833 Archived-At: On 24.01.2016 17:23, Yuri Khan wrote: > On Sun, Jan 24, 2016 at 6:41 PM, Andrew Gaydenko wrote= : >=20 >> How to keep key bindings working after switching keyboard layout? >> Saying "layout" I mean Linux workstation running X11 and having also g= ot >> an alternative-to-Latin keyboard layout configured in X11 conf files. >=20 > 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. >=20 > 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 ha= ve 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. >=20 > Another workaround is to add to =E2=80=9Ckey-translation-map=E2=80=9D m= appings from > C-=D0=B9 to C-q, C-=D1=86 to C-w, C-=D1=83 to C-e, =E2=80=A6, and simil= arly for M-=D0=B9, C-M-=D0=B9, > and so on: >=20 > (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 >=20 > 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 bindi= ngs > (e.g. =E2=80=9Cg=E2=80=9D to refresh a Dired buffer) cannot be translat= ed this way. >=20 > 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