edt: Unix
4.4 General Notes on Using <NumLock> for the <PF1> Key on Unix Systems
======================================================================
Making the physical <NumLock> key available for use in the EDT Emulation
requires some modification to the default X Window settings. Since the
keycode assignments vary from system to system, some investigation is
needed to see how to do this on a particular system.
You will need to look at the output generated by ‘xmodmap’ invoked
with the "-pm" switch. For example, on RedHat GNU/Linux 5.2 on a PC, we
get the following output when running ‘xmodmap -pm’:
xmodmap: up to 2 keys per modifier, (keycodes in parentheses):
shift Shift_L (0x32), Shift_R (0x3e)
lock Caps_Lock (0x42)
control Control_L (0x25), Control_R (0x6d)
mod1 Alt_L (0x40), Alt_R (0x71)
mod2 Num_Lock (0x4d)
mod3
mod4
mod5 Scroll_Lock (0x4e)
Note that Num_Lock is assigned to the modifier ‘mod2’. This is what
hides Num_Lock from being seen by Emacs.
Now, ‘xmodmap -pke’ yields:
.
.
.
keycode 77 = Num_Lock Pointer_EnableKeys
.
.
.
keycode 96 = F12
.
.
.
So, in RedHat GNU/Linux 5.2 on a PC, Num_Lock generates keycode 77. The
following steps are taken:
1. clear the assignment of Num_Lock to mod2;
2. swap the keycodes assigned to F12 and Num_Lock;
3. assign Num_Lock back to mod2.
The ‘.xmodmaprc’ file looks like this:
! File: .xmodmaprc
!
! Set up PC keypad under GNU/Linux for the Emacs EDT Emulation
!
clear mod2
keycode 77 = F12
keycode 96 = Num_Lock Pointer_EnableKeys
add mod2 = Num_Lock
So, after executing ‘xmodmap .xmodmaprc’, a press of the physical
<F12> key looks like a Num_Lock keypress to X. Also, a press of the
physical <NumLock> key looks like a press of the <F12> key to X.
Now, ‘edt-mapper.el’ will see ‘f12’ when the physical <NumLock> key
is pressed, allowing the <NumLock> key to be used as the EDT <PF1>
(<GOLD>) key.