How to make xterm to send the Alt key to emacs as Meta?
As seen in the Arch Wiki, you need to make Xterm to send the correct escaped key to the program:
If you use the Alt key for keyboard shortcuts, you will need this in your resource file:
XTerm*metaSendsEscape: true
So, just do:
echo 'XTerm*metaSendsEscape: true' >> ~/.Xresources
And restart your Xterm session.
If updating ~/.Xresources doesn't work for you, do as the documentation says and update it in ~/.Xdefaults
http://frequal.com/linux/XTermMetaSendsEscape.html
There is an interesting alternative to managing your .Xdefaults
/ .Xresources
files by providing the resource string directly as xterm
command line option:
xterm -xrm 'xterm*VT100.metaSendsEscape: true'
This is handy, for example, if you have a custom alias for x-terminal-emulator
anyway.