http://invisible-island.net/xterm/xterm.faq.html
Copyright © 2020,2021 by Thomas E. Dickey
XXX
XXX
The meta key predates X (originally in custom-built terminals, later in commercial terminals). 4.2BSD termcap listed a half-dozen terminals which had a meta key:
Some programs such as E (see 1974 manual) were written to use the meta key if it was available. The technical report Essential E (1980) mentions E's use with DataDisc and DataMedia terminals. Later, other developers copied the feature, e.g., Emacs (see 1978 manual).
The documentation for Emacs 147 (1980) allowed for the possibility that the terminal had no Meta key:
Meta refers to the Meta key. A character's name includes the word Meta if the Meta key must be held down in order to type the character. If there is no Meta key, then the Altmode character is used as a prefix instead. See section 2 [Meta], page 9.
However, the Altmode character was not (as some readers may have assumed) the Alt key on a “PC keyboard” (still in the future when the Emacs manual was written), but the ASCII escape character.
XXX need transition here pointing out that X uses keyboards too
Shift
and Control
are regular X11 modifiers, but Meta
is
not:
Meta_L
and
Meta_R
assignable via xmodmap, and
equating Alt with Meta. Neither Alt or Meta is a modifier,
but Alt is more likely to be on the keyboard.
This release also added keymap tables for the server; Meta was used frequently in HP keymaps, which were the most extensive set of keymaps.
Meta_L
or Meta_R
is found in the keysyms for a
given modifier, that the client should use that modifier.XXX
This function follows the ICCCM, picking the modifier which contains the Meta_L/Meta_R keysyms (if available), falling back to the Alt_L/Alt_R (as per X11R3), and ultimately to mod1 (per X11R1).
XXX
XXX the half-dozen terminals cited with meta-key weren't latching.
XXX none of the BSD termcaps defined mm/mo to "latch" meta mode.
XXX CSRG 4.2BSD termcap from July 1983 lists only the teleray 10 special with "km". CSRG 4.3BSD termcap from June 1986 has also the dmchat and hp2392. A few others (XXX) have MT, which esr said is the same thing.
XXX CSRG 4.3BSD (date?) has source for xterm (version?) from 1986/05/16. Its terminfo (not termcap) lists km, for meta key.
XXX CSRG 1991/09/20 jak removed km from wy60, saying it has no meta key.
XXX CSRG 1989/04/22 jak added km to sun, per rms.
XXX perhaps https://deskthority.net/wiki/Sun_Type_3
XXX
xmodmap: up to 4 keys per modifier, (keycodes in parentheses): shift Shift_L (0x32), Shift_R (0x3e) lock Caps_Lock (0x42) control Control_L (0x25), Control_R (0x69) mod1 Alt_L (0x40), Alt_R (0x6c), Meta_L (0xcd) mod2 Num_Lock (0x4d) mod3 mod4 Super_L (0x85), Super_R (0x86), Super_L (0xce), Hyper_L (0xcf) mod5 ISO_Level3_Shift (0x5c), Mode_switch (0xcb)
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) mod2 Mode_switch (0x71) mod3 Num_Lock (0x4d) mod4 Meta_L (0x73), Meta_R (0x74) mod5
xmodmap: up to 4 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) mod2 Num_Lock (0x4d) mod3 Scroll_Lock (0x4e), Multi_key (0x75) mod4 Meta_L (0x73), Meta_R (0x74), Super_L (0x7f), Hyper_L (0x80) mod5 Mode_switch (0x8), ISO_Level3_Shift (0x71), ISO_Level3_Shift (0x7c)
xmodmap: up to 2 keys per modifier, (keycodes in parentheses): shift Shift_L (0x40), Shift_R (0x44) lock Caps_Lock (0x41) control Control_L (0x43), Control_R (0x46) mod1 Mode_switch (0x42), Mode_switch (0x45) mod2 Meta_L (0x3f), Meta_R (0x47) mod3 mod4 mod5
xmodmap: up to 2 keys per modifier, (keycodes in parentheses): shift Shift_L (0x40), Shift_R (0x44) lock Caps_Lock (0x41) control Control_L (0x43), Control_R (0x46) mod1 Alt_L (0x42), Alt_R (0x45) mod2 Meta_L (0x3f), Meta_R (0x47) mod3 mod4 mod5
dtterm(1) mentions kshMode, which uses escape+character rather than meta-mode, saying it was for emacs.
XXX
XXX urxvt uses this resource:
modifier: modifier Set the key to be interpreted as the Meta key to: alt, meta, hyper, super, mod1, mod2, mod3, mod4, mod5; option -mod.
It ignores case when comparing those names (unlike Xt). In initialization, it uses XGetModifierMapping, assigns meta to any match on keysyms Meta_L or Meta_R, falling through to any match on Alt_L or Alt_R
XQuartz preferences has a setting that makes Alt_L/Alt_R by default send Mode_Switch as mask 0x2000, though xmodmap shows it on mod1:
mod1 Alt_L (0x42), Alt_R (0x45) mod2 Meta_L (0x3f), Meta_R (0x47)
Xt/TMparse.c has these relevant entries:
{"Mod1", 0, ParseModImmed,Mod1Mask}, {"Mod2", 0, ParseModImmed,Mod2Mask}, {"Meta", 0, ParseModSym, XK_Meta_L}, {"Alt", 0, ParseModSym, XK_Alt_L}, {"m", 0, ParseModSym, XK_Meta_L}, {"a", 0, ParseModSym, XK_Alt_L},
So... unless I rewrote the default-translation resources, xterm won't see the meta key as "Meta": only "Alt". Xt's table doesn't mention Alt_R or Meta_R, by the way.
XXX this is why procura's translation doesn't work for me.
from /usr/doc/keytables/kbd.FAQ: I don't know how to convince xterm that it should use the X keymap when Alt is pressed; it seems just to look at its resource eightBitInput, and depending on whether that is true or false either set the high order bit of the character, or generate an additional Escape character (just like setmetamode(1) does for the console).