VT420 Meta (Alt) Key
Posted <2016-06-22 Wed 01:19> by Aaron S. Jackson.
Getting the Emacs to understand the control characters sent by a VT420's alt key is a little annoying. I haven't found a good solution yet, but I've found one which works a bit.
Here is what I have so far:
(global-unset-key (kbd "M-\\"))
(global-unset-key (kbd "M-_ : A 0 1 1 0"))
(global-unset-key (kbd "M-_ : A 0 1 0 0"))
(global-set-key (kbd "M-_ : A 0 1 1 0") 'ignore)
(global-set-key (kbd "M-_ : A 0 1 0 0 M-\\") 'ignore)
(global-set-key (kbd "M-\\ x") 'execute-extended-command)
(global-set-key (kbd "M-\\ u") 'upcase-word)
(global-set-key (kbd "M-\\ l") 'downcase-word)
(global-set-key (kbd "M-\\ t") 'transpose-words)
(global-set-key (kbd "M-\\ <left>") 'left-word)
(global-set-key (kbd "M-\\ <right>") 'right-word)
When you press the alt key, it sends "^[_:A0110^[\" so we ignore the first part and use "^[\" as our new alt key. I haven't found a nice way to automatically generate the shortcuts yet… Also, I you can't do things like "M-<left> <left> <left>", instead you have to do "M-<left> M-<left> M-<left>" etc.
Related posts:
Wanting to leave a comment?
Comments and feedback are welcome by email (aaron@nospam-aaronsplace.co.uk).