Why doesn’t my Meta key work in an xterm window?
See Single-Byte Character Set Support in The GNU Emacs Manual.
If the advice in the Emacs manual fails, try all of these methods before asking for further help:
You may have big problems using
mwmas your window manager. (Does anyone know a good generic solution to allow the use of the Meta key in Emacs withmwm?)For X11: Make sure it really is a Meta key. Use
xevto find out what keysym your Meta key generates. It should be eitherMeta_LorMeta_R. If it isn’t, usexmodmapto fix the situation. If Meta does generateMeta_LorMeta_R, but M-x produces a non-ASCII character, put this in your~/.Xdefaultsfile:bashXTerm*eightBitInput: false XTerm*eightBitOutput: trueMake sure the
ptythextermis using is passing 8 bit characters. ‘stty -a’ (or ‘stty everything’) should show ‘cs8’ somewhere. If it shows ‘cs7’ instead, use ‘stty cs8 -istrip’ (or ‘stty pass8’) to fix it.If there is an
rloginconnection betweenxtermand Emacs, the ‘-8’ argument may need to be given to rlogin to make it pass all 8 bits of every character.If all else fails, you can make
xtermgenerate ESC W when you type M-W, which is the same conversion Emacs would make if it got the M-W anyway. In X11R4, the following resource specification will do this:bashXTerm.VT100.EightBitInput: false(This changes the behavior of the
insert-eight-bitaction.)With older
xterms, you can specify this behavior with a translation:bashXTerm.VT100.Translations: #override \ Meta<KeyPress>: string(0x1b) insert()You might have to replace ‘
Meta’ with ‘Alt’.