Article View: gnu.epoch.misc
Article #1011rebind-key and CAPS LOCK and BSP
From: Jerry
Date: Wed, 17 Mar 1993 21:18
Date: Wed, 17 Mar 1993 21:18
98 lines
4109 bytes
4109 bytes
Here's what I use here for a Sun4 keyboard. (Most of it) should work
for you, too. Note that this takes care of NUM LOCK, CAPS LOCK, and
both together. Explanation of this is below the elisp; please read it
since the xmodmap modifiers may be set up differently on your system
(e.g., there may be no Alt binding, etc.)
;; Rebind BSP key
(rebind-key "BackSpace" 0 "\C-?")
(rebind-key "BackSpace" 'lock "\C-?")
(rebind-key "BackSpace" 'mod4 "\C-?")
(rebind-key "BackSpace" 66 "\C-?")
(rebind-key "BackSpace" 'control "\C-x\C-k")
(rebind-key "BackSpace" 6 "\C-x\C-k")
(rebind-key "BackSpace" 68 "\C-x\C-k")
(rebind-key "BackSpace" 'meta "\e\C-?")
(rebind-key "BackSpace" 10 "\e\C-?")
(rebind-key "BackSpace" 72 "\e\C-?")
(rebind-key "BackSpace" 'shift "\C-x\C-?")
(rebind-key "BackSpace" 3 "\C-x\C-?")
(rebind-key "BackSpace" 65 "\C-x\C-?")
(rebind-key "BackSpace" 'mod3 "\e\\")
(rebind-key "BackSpace" 34 "\e\\")
(rebind-key "BackSpace" 96 "\e\\")
(rebind-key "BackSpace" 9 "\e\\")
;; Rebind DEL key
;; Control-Alt-Delete does logout (saves buffers, kills epoch, kills X, then login shell)
(rebind-key "Delete" 36 "\C-x\C-_")
(rebind-key "Delete" 38 "\C-x\C-_")
(rebind-key "Delete" 100 "\C-x\C-_")
(rebind-key "Delete" 102 "\C-x\C-_")
(rebind-key "Delete" 0 "\C-d")
(rebind-key "Delete" 'lock "\C-d")
(rebind-key "Delete" 'mod4 "\C-d")
(rebind-key "Delete" 66 "\C-d")
(rebind-key "Delete" 'control "\C-k")
(rebind-key "Delete" 6 "\C-k")
(rebind-key "Delete" 68 "\C-k")
(rebind-key "Delete" 'meta "\ed")
(rebind-key "Delete" 10 "\ed")
(rebind-key "Delete" 72 "\ed")
(rebind-key "Delete" 'shift "\ek")
(rebind-key "Delete" 3 "\ek")
(rebind-key "Delete" 65 "\ek")
(rebind-key "Delete" 'mod3 "\C-x\C-o")
(rebind-key "Delete" 34 "\C-x\C-o")
(rebind-key "Delete" 96 "\C-x\C-o")
(rebind-key "Delete" 9 "\C-x\C-o")
;; Mask list
;; normal = 0
;; shift = 1
;; caps lock = 2 (lock)
;; control = 4
;; meta = 8 (mod1)
;; alt = 32 (mod3)
;; num lock = 64 (mod4)
;; For multiple modifiers, just add up the numbers.
;; Note that we define keys identically for 0, 2, and 64
;; so that Caps Lock and Num Lock don't screw up arrows keys
;; or simple (no modifier) function keys. Could have dones this
;; for _every_ binding, but enuf's enuf.
Here are some examples for a Sun4 keyboard for the key labeled
"Props," but known to X as "L3" which does
Props call-last-kbd-macro
C-Props start-kbd-macro
M-Props end-kbd-macro
S-Props name-last-kbd-macro
A-Props insert-kbd-macro
where C is control, M is meta, S is shift, and A is alt. Note that
when Num Lock or Caps Lock is active, things still work. I defined
functions for every function key on the Sun4 keyboard and, if I can
manage to keep this account long enough, I'll be porting this
interface to GNU Emacs 19 (maybe even with documentation!).
(rebind-key "L3" 0 "\C-xe")
(rebind-key "L3" 'lock "\C-xe")
(rebind-key "L3" 'mod4 "\C-xe")
(rebind-key "L3" 66 "\C-xe")
(rebind-key "L3" 'control "\C-x(")
(rebind-key "L3" 6 "\C-x(")
(rebind-key "L3" 68 "\C-x(")
(rebind-key "L3" 'meta "\C-x)")
(rebind-key "L3" 10 "\C-x)")
(rebind-key "L3" 72 "\C-x)")
(rebind-key "L3" 'shift "\C-x4(")
(rebind-key "L3" 3 "\C-x4(")
(rebind-key "L3" 65 "\C-x4(")
(rebind-key "L3" 'mod3 "\C-x4)")
(rebind-key "L3" 34 "\C-x4)")
(rebind-key "L3" 96 "\C-x4)")
-Jerry
Technical Details
Message-ID:
<9303172002.AA13759@banach.math.ep.utexas.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!stanford.edu!agate!howland.reston.ans.net!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!math.ep.utexas.EDU!jerryShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fc7ee,fcbd38fe0779def9,start X-Google-Attributes: gidfc7ee,public X-Google-ArrivalTime: 1993-03-17 13:31:59 PST Path: arc1-ca.pugleaf.net!sparky!uunet!stanford.edu!agate!howland.reston.ans.net!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!math.ep.utexas.EDU!jerry From: jerry@math.ep.utexas.EDU (Jerry) Newsgroups: gnu.epoch.misc Subject: rebind-key and CAPS LOCK and BSP Date: 17 Mar 1993 16:18:21 -0500 Organization: Department of Mathematical Sciences University of Texas at El Paso Lines: 98 Sender: daemon@cis.ohio-state.edu Distribution: gnu Message-ID: <9303172002.AA13759@banach.math.ep.utexas.edu>