Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
09-30-2006, 07:54 AM
|
#1
|
LQ Newbie
Registered: Sep 2006
Posts: 2
Rep:
|
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.
- Aviv
|
|
|
09-30-2006, 08:30 AM
|
#2
|
LQ Guru
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
|
I don't use emacs (and slap any developer that asks me to install it).
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:
export TERM=<termtype>.
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.
|
|
|
09-30-2006, 03:43 PM
|
#3
|
LQ Newbie
Registered: Sep 2006
Posts: 2
Original Poster
Rep:
|
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:
Alt-right: ^[[1;3C
Shift-right: ^[[;2C
The values in rxvt are:
Alt-right: ^[^[[C
Shift-right: ^[[c
5)
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 07:20 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|