LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
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



Reply
 
Search this Thread
Old 09-30-2006, 08:54 AM   #1
Aviv Hurvitz
LQ Newbie
 
Registered: Sep 2006
Posts: 2

Rep: Reputation: 0
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
 
Old 09-30-2006, 09:30 AM   #2
MensaWater
Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 6,028
Blog Entries: 5

Rep: Reputation: 791Reputation: 791Reputation: 791Reputation: 791Reputation: 791Reputation: 791Reputation: 791
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.
 
Old 09-30-2006, 04:43 PM   #3
Aviv Hurvitz
LQ Newbie
 
Registered: Sep 2006
Posts: 2

Original Poster
Rep: Reputation: 0
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cant get the arrow keys to work properly :( fraggelfraggel *BSD 6 02-02-2006 01:49 AM
Numeric keypad arrow keys arielgr Linux - Newbie 2 08-23-2005 11:04 AM
VIM and the arrow keys Buto Linux - Software 1 09-16-2004 08:38 PM
Arrow keys in nethack Levitate Linux - Games 3 08-22-2004 12:44 PM
Arrow keys dont work in JAVA under GNOME budhusa Linux - Hardware 1 02-08-2004 12:37 PM


All times are GMT -5. The time now is 09:39 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration