From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Ben Bacarisse Newsgroups: gmane.emacs.help Subject: Re: Mapping AltGr+t key as a Ctrl+x (How to use AltGr key effectively in Emacs) Date: Sun, 27 Aug 2017 22:23:12 +0100 Organization: A noiseless patient Spider Message-ID: <87bmn0yabj.fsf@bsb.me.uk> References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1503869134 19786 195.159.176.226 (27 Aug 2017 21:25:34 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 27 Aug 2017 21:25:34 +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 Aug 27 23:25:29 2017 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dm53d-0004gt-3t for geh-help-gnu-emacs@m.gmane.org; Sun, 27 Aug 2017 23:25:25 +0200 Original-Received: from localhost ([::1]:35545 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dm53j-0007tF-Nz for geh-help-gnu-emacs@m.gmane.org; Sun, 27 Aug 2017 17:25:31 -0400 Original-Path: usenet.stanford.edu!goblin3!goblin1!goblin.stu.neva.ru!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 55 Original-Injection-Info: mx02.eternal-september.org; posting-host="db7b0849645f88d823fbfaf452bc1501"; logging-data="23631"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18yVv57ZTByi9SSk8gnaSFnTa3KyCOMuPg=" Cancel-Lock: sha1:mcib0KAdbUOwb1QpDJVUnJPdX8c= sha1:LU3wYoBkWTRO9S/+Kz6yCBvs9uA= X-BSB-Auth: 1.acaab1de1fdf378043f8.20170827222312BST.87bmn0yabj.fsf@bsb.me.uk Original-Xref: usenet.stanford.edu gnu.emacs.help:220007 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 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" Xref: news.gmane.org gmane.emacs.help:114108 Archived-At: ozhan fenerci writes: > I am using international keyboard and extensively use AltGr key. There are > many unused keys with AltGr so I would like to map " AltGr+ t= Crtl+x " ( I > don't want to remap AltGr to Crtl; I just want to use this specific > instance.) > > I know that AltGr is not a modifier key. I am thinking to modify xkb file > to achieve it. Any advice? Warning: nasty hack follows... On X11, AltGr *is* a modifier key (it's "ISO_Level3_Shift" on my system) and the following won't work if that's not the case for you. You can use xev to check. 1. Pick a key symbol that you know is not used by your keyboard. Here I will use XF86Game -- I have no "game" key so I am not losing anything by doing this. 2. Save your xmodmap file so you have a chance of restoring it (without an X11 restart) if all goes wrong: xmodmap -pke >~/xmodmap-saved You'd restore the original mapping with xmodmap ~/xmodmap-saved 3. Next, use xmodmap to make AltGr+t generate XF86Game: xmodmap -e 'keycode 28 = t T t T XF86Game' To make this permanent, put that line in your ~/.Xmodmap file. The symbols that follow the = sign give the key symbols generated for keycode 28 (t) both "plain" and with various modifier keys. I find the details of this confusing, so I just remember that, for my setup at least, the the fith one is the symbol you get when "AltGr" is down the sixth when AltGr+shift are down). There are many more states than this and I can't remember them all. For example, before doing this $ xmodmap -pke | grep ' 28 ' keycode 28 = t T t T tslash Tslash tslash Tslash t T tslash Tslash t T tslash Tslash 4. Finally, you bind X86Game in Emacs to do whatever you like. This can fail in lots of ways. You can have different modifier keys set up. Your system might not load .Xmodmap in login (technically during X initialisation) and so on. -- Ben.