Topic: Emacs
This post mentions vintage computer keyboards. Starting about 2010,
a disturbing trend has emerged of keyboard junkies
buying up
vintage computer keyboards and consoles to scrap them for
key switches or destructively modify them to add USB HID interfaces.
This has caused a shortage of keyboards and consoles for vintage
computer equipment. Many serious preservationists of historical
computers are now having great difficulties obtaining consoles and
keyboards for restoration projects because of this vandalism.
Fortunately, since I first investigated manufacturing of Lisp Machine-style keyboards in 2011, making custom keyboards has become an easily accessible hobby. Signature Plastics have manufactured several mass-order rounds of reproduction Space Cadet double-shot spherical-profile key caps for Cherry key switches. If you are thinking of buying an old computer keyboard just to take it apart or use it on a modern system, don't. There is no reason to anymore. As this blog post will show, any PC104/105 keyboard layout can, with a few software tweaks, get all the advantages of the Lisp Machine keyboard layout.
I have used both the old-style and new-style Symbolics keyboards, and I cannot recommend them. Cherry switches simply have better travel and feel than Honeywell ones. A PC104/105 keyboard (particularly with a PS/2 interface) with Cherry switches and the Signature Plastics group buy key caps is a superior keyboard.
Please don't ruin vintage computer keyboards.
If you take a look at the Symbolics keyboard, there are some more notable differences to PC QWERTY keyboards:
These differences place more often used keys closer to the home row, making the Lisp Machine layout better not just for Emacs, but for most keyboard input.
With a PC104/105 keyboard layout, you have three modifier keys available on the left of the space bar to bind to Super, Meta, and Control, and four right modifier keys to bind to Control, Meta, Super, and Hyper. Depending on the keyboard model, the Windows Menu key might have problems with n-key rollover.
Modifying the keyboard layout in X11 is straightforward. You can run xev to find out the key codes for your particular keyboard interactively, xmodmap -pke to print the current keymap table, xmodmap -e to try out changes interactively, and then load the changes in your ~/.xinitrc on X11 start up.
The laptop keyboard I am typing this on has less than 90 real keys, but is auto-detected as a US PC104 layout keyboard. You can see which layout X11 is currently using by running setxkbmap -query. Unfortunately this laptop is missing a right Windows Menu key so there is nowhere to put Hyper.
Here is the ~/.xmodmaprc:
keycode 22 = BackSpace
remove Lock = Caps_Lock
keycode 66 = BackSpace
keycode 34 = parenleft braceleft
keycode 35 = parenright braceright
keycode 18 = 9 bracketleft
keycode 19 = 0 bracketright
clear Control
clear mod1
clear mod4
keycode 37 = Super_L
keycode 115 = Alt_L Meta_L
keycode 64 = Control_L
keycode 113 = Control_R
keycode 117 = Alt_R Meta_R
keycode 109 = Super_R
add mod4 = Super_L Super_R
add mod1 = Alt_L Alt_R
add Control = Control_L Control_R
If you use multiple keyboard groups (most commonly used for multiple
language layouts), you will need to specify the symbols for the other
groups as part of the remapping, to avoid "losing" those
keys. For example, for Russian as a second layout (-layout
us,ru
parameter for
setxkbmap) you would specify:
keycode 34 = parenleft braceleft Cyrillic_ha
keycode 35 = parenright braceright Cyrillic_hardsign
X11 comes with some of these re-mappings available under various names as -option parameters to setxkbmap. Swapping braces can be done with -option parens:swap_brackets and Caps Lock as Backspace with -option capslock:backspace. I prefer to use ~/.xmodmaprc. All the options can be found in /usr/X11R6/share/X11/xkb/symbols/; look around and you might find something else that would be useful to your setup.
keycode 22 = BackSpace unsets the Terminate_Server
keysym from the Backspace key;
C-M-<backspace> can now be used
for backward-kill-sexp
in Emacs instead of zapping the
X11 server. Alternatively, you can edit the global X
Keyboard Extension rules file.
After ~/.xmodmaprc is done, load the keyboard map and turn repeat back on for Rub Out using xset in ~/.xinitrc, after any calls to setxkbmap:
xmodmap ~/.xmodmaprc
xset r 66
Calling setxkbmap to set multiple layouts would go first, so ~/.xinitrc would look like:
setxkbmap -model pc105 -layout us,ru -option grp:shifts_toggle
xmodmap ~/.xmodmaprc
xset r 66
Other resources: