efaq: Meta key does not work in xterm
9.13 Why doesn’t my <Meta> key work in an ‘xterm’ window?
=========================================================
Single-Byte Character Set Support (emacs)Unibyte Mode.
If the advice in the Emacs manual fails, try all of these methods
before asking for further help:
• You may have big problems using ‘mwm’ as your window manager.
(Does anyone know a good generic solution to allow the use of the
<Meta> key in Emacs with ‘mwm’?)
• For X11: Make sure it really is a <Meta> key. Use ‘xev’ to find
out what keysym your <Meta> key generates. It should be either
‘Meta_L’ or ‘Meta_R’. If it isn’t, use ‘xmodmap’ to fix the
situation. If <Meta> does generate ‘Meta_L’ or ‘Meta_R’, but ‘M-x’
produces a non-ASCII character, put this in your ‘~/.Xdefaults’
file:
XTerm*eightBitInput: false
XTerm*eightBitOutput: true
• Make sure the ‘pty’ the ‘xterm’ is 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 ‘rlogin’ connection between ‘xterm’ and Emacs, the
‘-8’ argument may need to be given to rlogin to make it pass all 8
bits of every character.
• If Emacs is running on Ultrix, it is reported that evaluating
‘(set-input-mode t nil)’ helps.
• If all else fails, you can make ‘xterm’ generate ‘<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:
XTerm.VT100.EightBitInput: false
(This changes the behavior of the ‘insert-eight-bit’ action.)
With older ‘xterm’s, you can specify this behavior with a
translation:
XTerm.VT100.Translations: #override \
Meta<KeyPress>: string(0x1b) insert()
You might have to replace ‘Meta’ with ‘Alt’.