Shift-arrow and Alt-arrow keys don't work in xterm
For instance, when I press shift-right in xterm, it prints 2C and rings a bell.
When I press alt-right, it prints 3C and rings a bell.
When I run emacs inside a xterm, "emacs -nw", these keys won't work. Nor will they in the xterm command prompt.
Both of these keys DO work in the X-Windows-y version of GNU emacs.
Thanks for your help.
I don't use emacs (and slap any developer that asks me to install it). :p
Having said that though it may be your TERM variable.
echo $TERM to see what it is set to. It ought to be be xterm rather than vt100. It may be these keys aren't defined by any of the standard term types (type "man terminfo" for more detail on term types). If so it may be possible to make a modified version that does have them defined. infocmp will dump an existing definition (see man infocmp for more detail). You can modify the output (make sure you modify name as well) then use tic to compile the new file. You then make that your new TERM variable by typing:
e.g. you could do infocmp xterm >xterm_emacs and modify xterm_emacs then run tic xterm_emacs then do export TERM=xterm_emacs.
Of course its always possible the key definitions you are talking about only have meaning in the GUI emacs.
Well you gave me some good leads there with the infocmp tip. After a couple of hours of investigation, I've advanced but still haven't solved the problem. Needs more work. This email is a bit long and lists some facts I discovered, but probably not enough for anyone to solve my problem.
1) My $TERM variable is xterm. The codes file is probably unmodified from the Debian distrib.
2) I wonder, what do you experience in an xterm when you press Alt-arrows or Shift arrows?
3) To see the codes coming to the terminal, I run cat -vt.
4) I wonder, what do you see using cat -vt when doing Alt-right and Shift-right. I see:
The values in rxvt are:
Emacs and rxvt work well together because:
ESC's code is simply ^[.
And right-arrows code is ^[[C.
So Emacs under rxvt sees Alt-right-arrow as ESC followed by right-arrow, and this works.
6) It is not clear to me which var in infocmp defines the Alt-arrow sequences. I suspect they aren't defined explicitly, but rather there's some default mechanism for handling Alt-keys and that kicks in for the Alt-arrow keys. And maybe the mechanism is different for rxvt and xterm.
7) The shift-arrow keys also need more work. They don't work in rxvt or xterm.
8) The best source of info that I found on these issues is:
www dot linuxjournal dot com/article/0138 (I can't post URLs)
The article suggests that the problem may be solved in a different way: by creating a new "term.el" style file that recognizes whatever weird codes are emitted by the terminal, and does the right thing. I'm not sure that's the way to go, because it will fix emacs but won't fix any other programs that may depend on these keys.
|All times are GMT -5. The time now is 04:17 AM.|