Article View: gnu.epoch.misc
Article #1939Re: key mapping
From: Alan M. Carroll
Date: Tue, 23 Jul 1991 13:53
Date: Tue, 23 Jul 1991 13:53
59 lines
3557 bytes
3557 bytes
Key mapping is a little strange, due to the way X works. For various technical reasons (which I can provide for those interested), it's not feasible to provide direct access to the KeySyms of X. For instance, if you press PgDn on a Sparc keyboard, X reports the PageDown KeySym to Epoch, which doesn't correspond to any ASCII key. GNU Emacs deals with this by using internal, hardwired mappings. For Suns, the cursor keys are mapped into the standard cursor movement keys (do a global-set-key on ^P and then see what the up arrow does). Other X KeySyms are mapped into the ESC xxxz (xxx~ for non-Suns) sequences, presumably because of the way VT100's worked. This is the default in Epoch, for compatability reasons. However, if this annoys you as much as it annoys me, you can turn it off by setting the variable epoch::function-key-mapping to nil. The X window system provides the ability to have particular KeySyms generate arbitrary ASCII sequences, and Epoch provides access to this feature via the (rebind-key) function. So, to have F1 generate ESC (which is sort of handy), you can do (rebind-key "F1" nil "\C-[") As a side note, rebind-key works on _any_ key. For instance, I use control minus to close all but the current window (normally ^X1). I do this with (rebind-key "minus" 'control "\C-^C-") (global-set-key "\C-^C-" 'delete-other-windows) ;control - The problem is that non-ASCII KeySyms must be maped into ASCII sequences, and the set of sequences is crowded under Emacs. My solution was to establish my own convention for rebinding, where all rebound sequences start with control ^ (which is unused), followed by standardized indicators. Code that does this can be found in ./contrib/amc/keys.el, which is the version that I used at the time of the 3.2 release (I've since upgraded, since I'm always fiddling with things). What's the point? In order to have PgUp do what you expect, you have to do 2 things. First, rebind-key the KeySym to an ASCII sequence. Second, global-set-key that sequence to an interactive function that moves up a page. For a Sun-4 keyboard, this could be done with (rebind-key "R9" nil "\C-^k9") (global-set-key "\C-^k9" 'scroll-down) ; Page Up I recommend the use of the "xev" program for this. It will tell you what KeySym is being generated by a particular key. Also, note that these rebindings apply only to Epoch, not to other X clients that might be running. Douglas Rand also wrote an improved version of the system I used, where much of the work is done automatically, which I can repost if there's a lot of demand for it. -- Alan M. Carroll <-- Another casualty of applied metaphysics Epoch Development Team Urbana Il. "I hate shopping with the reality-impaired" - Susan
Technical Details
Message-ID:
<1991Jul23.135319.15082@m.cs.uiuc.edu>Path:
arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!cis.ohio-state.edu!pacific.mps.ohio-state.edu!linac!uwm.edu!ux1.cso.uiuc.edu!m.cs.uiuc.edu!uiucdcs!carrollReferences:
<9107221940.AA24219@titan.tsd.arlut.utexas.edu>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fc7ee,11abf55c133cd X-Google-Attributes: gidfc7ee,public X-Google-ArrivalTime: 1991-07-23 09:40:23 PST Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!cis.ohio-state.edu!pacific.mps.ohio-state.edu!linac!uwm.edu!ux1.cso.uiuc.edu!m.cs.uiuc.edu!uiucdcs!carroll From: carroll@cs.uiuc.edu (Alan M. Carroll) Newsgroups: gnu.epoch.misc Subject: Re: key mapping Message-ID: <1991Jul23.135319.15082@m.cs.uiuc.edu> Date: 23 Jul 91 13:53:19 GMT References: <9107221940.AA24219@titan.tsd.arlut.utexas.edu> Sender: news@m.cs.uiuc.edu (News Database (admin-Mike Schwager)) Distribution: gnu Organization: Technophiles Inc. - Engineers with Attitude Lines: 59 Nntp-Posting-Host: ash.cs.uiuc.edu