[gnu.emacs] vt100 keypad codes on xemacs

wittig@gmdzi.UUCP (Georg Wittig) (10/02/89)

Gnu Emacs 18.53 and X11R3:

The keypad key `.' on a vt100 keyboard emits the escape sequence ``ESC O n''
(3 hex. characters). In the non-X11 emacs (`-nw' switch) this code is bound to
`delete-char'.

In xemacs however, this doesn't work. $TERMCAP is set to vt100. Even loading of
`term/vt100.el' and of `keypad.el' doesn't help.

Interestingly, typing `Cntl-Q' and then the keypad key `.' inserts a `.' into
the buffer. The function `delete-char' is executed if I enter the escape
sequence `ESC O n' (3 key strokes) "on foot".

So it seems that the software binding does work, but not the mapping of the
keypad key `.' to the above escape sequence.

What am I missing?

Thanks in advance,
-- 
Georg Wittig   GMD-Z1.BI   P.O. Box 1240   D-5205 St. Augustin 1 (West Germany)
email: wittig@gmdzi.uucp   phone: (+49 2241) 14-2294
-------------------------------------------------------------------------------
"Freedom's just another word for nothing left to lose" (Kris Kristofferson)

d-yang@cs.columbia.edu (David Yang) (10/07/89)

On the HDS-200, the up-arrow key is bound to the
key sequence ESC [ A.  I have tried

(define-global-key "\e[A" 'previous-line)

which doesn't work-- emacs is still reading
ESC [, doing the (backward-paragraph) command,
and then printing the letter A.
So,
1) Is the define-global-key okay?
2) If the problem is the same one as the vt100 question,
   how does one get emacs to take the 3-character sequence?
   (e.g., if it's a termcap problem, it'd be really nice
	  to know what in the termcap to fix, though I suppose
	  that would be a question for comp.terminal.)

Thanks in advance,
David Yang
d-yang@cs.columbia.edu

tale@pawl.rpi.edu (David C Lawrence) (10/09/89)

This is a frequently enough asked question that it should probably be
addressed briefly here again.

In <365@cs.columbia.edu> d-yang@cs.columbia.edu (David Yang) writes:
DY> On the HDS-200, the up-arrow key is bound to the key sequence ESC [ A
DY> I have tried (define-global-key "\e[A" 'previous-line)
DY> which doesn't work-- emacs is still reading ESC [, doing the
DY> (backward-paragraph) command, and then printing the letter A.

DY> 1) Is the define-global-key okay?

Depends on whether you happen to have that function doing the right
thing.  There is no define-global-key in GNU Emacs as distributed;
perhaps you meant global-set-key?

In order to access the rest of the binding, if you do have M-[ A
correctly bound, Emacs needs to follow key prefixes to it.  Since
backward-paragraph is still bound to M-[ it can't do that.  A
global-unset-key of M-[ will enable Emacs to look further for the A,
and hence the command to execute.

DY> 2) If the problem is the same one as the vt100 question,
DY>    how does one get emacs to take the 3-character sequence?

Which vt100 question?  Anyway, you can
(setq term-setup-hook 'enable-arrow-keys)
in .emacs to have the arrow keys enabled after the term/$TERM.el file
is loaded.  See emacs/lisp/term/*.el and emacs/lisp/keypad.el for more
information.

Dave
--
 (setq mail '("tale@pawl.rpi.edu" "tale@itsgw.rpi.edu" "tale@rpitsmts.bitnet"))