[comp.emacs] jove & vt100

robe@wmt.UUCP (Rob van den Berg) (05/10/88)

I have just collected the JOVE sources from comp.sources.unix
and have compiled them succesfully on a SUN and an APOLLO.

However I do not seem to be able to use my cursorkeys as they send an 
escape sequence JOVE can't interpret. These sequence are:

	left	^[OC
	right	^[OD
	up		^[OA
	down	^[OB

Can someone help me ?

	Rob.
-- 
Rob van den Berg			tel: +31 15 569224
WestMount Technology B.V.		email: robe@wmt
Poortweg 4
2612 PA Delft, the Netherlands

sperling@acf8.UUCP (George Sperling) (05/12/88)

Rob writes

>However I do not seem to be able to use my cursorkeys as they send an 
>escape sequence JOVE can't interpret. These sequence are:
>
>	left	^[OC
>	right	^[OD
>	up		^[OA
>	down	^[OB
>
>Can someone help me ?

You have to bind the function "ansi-codes" to the lead-in sequence of
your function keys. This is usually "ESC [", but Jove sets the VT100
into keypad applications mode, and in that mode the terminal sends
"ESC O". All you have to do is to put the line
	bind-to-key ansi-codes ESC O
into your .joverc file. This will allow you to use the cursor keys on
a VT100. I have a patch for ansi-codes which knows about more of the
function keys on a VT100. 

Karl Gegenfurtner

arpa:	karl@hipl.psych.nyu.edu
uucp:	...{seismo|ihnp4|allegra}!cmcl2!xp!hipl!karl
usps:	Department of Psychology, NYU
	6 Washington Place, 8th fl.
	New York, NY 10003

wongpw@isl.Stanford.EDU (Ping Wah Wong) (05/12/88)

George Sperling writes:

>Rob writes
>
>>However I do not seem to be able to use my cursorkeys as they send an 
>>escape sequence JOVE can't interpret.
>
>You have to bind the function "ansi-codes" to the lead-in sequence of
>your function keys. This is usually "ESC [", but Jove sets the VT100
>into keypad applications mode, and in that mode the terminal sends
>"ESC O". All you have to do is to put the line
>	bind-to-key ansi-codes ESC O
>into your .joverc file. This will allow you to use the cursor keys on
>a VT100. I have a patch for ansi-codes which knows about more of the
>function keys on a VT100. 

If I use several different terminals, how do I tell jove (supposedly
through the .joverc file) to interpret the cursor and function keys
correctly? Thanks in advance!

Ping (wongpw@isl.stanford.edu)

yuval@taux01.UUCP (Gideon Yuval) (05/12/88)

The 3-character sequences can be defined as  prefix-3  sequences,  where  the
prefix-3  character  is  itself  a  2  character  sequence.  A  set  of VT220
definitions follows; change "_" to "O"  (&  utter  appropriate  incantations)
to get VT100 support.

There  was  a  VT100  Jove  support  package  in  one  of the comp.sources...
archives; but I lost the pointer. If it were to be reposted, this might help.

Juju (er, I mean, .joverc file) follows:
--------------------------------------------------------------
bind-to-key prefix-3 ^_
bind-to-key previous-line ^_H
bind-to-key next-line ^_P
bind-to-key forward-character ^_M
bind-to-key backward-character ^_K

bind-to-key delete-previous-character ^H

bind-to-key forward-word ^_O
bind-to-key backward-word ^_Q

bind-to-key beginning-of-line ^_G
bind-to-key end-of-line ^_I

bind-to-key quadruple-numeric-argument ^_L
bind-to-key delete-next-character ^_@
bind-to-key kill-next-word ^_>
bind-to-key kill-to-end-of-line ^_<

bind-to-key set-mark ^_D

bind-to-key next-window ^N
bind-to-key previous-window ^P
-- 
Gideon Yuval, yuval@taux01.nsc.com, +972-2-690992 (home) ,-52-522255(work)
 Paper-mail: National Semiconductor, 6 Maskit St., Herzliyah, Israel

sperling@acf8.UUCP (George Sperling) (05/12/88)

Ping asks
>If I use several different terminals, how do I tell jove (supposedly
>through the .joverc file) to interpret the cursor and function keys
>correctly? Thanks in advance!

Jove has the (undocumented???) feature of conditional execution of
commands in the .joverc file. The correct syntax is:

if unix-command
jove-commands
else
jove-commands
endif

The else is optional. You can use this to check your terminal type in
the environment. If checkenv is a program that returns 1 whenever
getenv(argv[2]) matches argv[3], your .joverc should read as follows:

if checkenv TERM vt100
set meta-key off
set allow-^S-and-^Q off
bind-to-key ansi-codes ESC O
else
bind-to-key ansi-codes ESC [
endif

The function ansi-codes in Jove knows about Escape sequences sent by
VTxxx terminals and Sun windows. Most terminals send the same escape
sequences for the cursor keys. If you have anything nonstandard, you
have to code it into the function AnsiCodes() in misc.c.


Karl Gegenfurtner

arpa:	karl@hipl.psych.nyu.edu
uucp:	...{seismo|ihnp4|allegra}!cmcl2!xp!hipl!karl
usps:	Department of Psychology, NYU
	6 Washington Place, 8th fl.
	New York, NY 10003
at&t:	

jpayne@rochester.UUCP (05/13/88)

In article <1040006@acf8.UUCP> sperling@acf8.UUCP (George Sperling) writes:
>The else is optional. You can use this to check your terminal type in
>the environment. If checkenv is a program that returns 1 whenever
>getenv(argv[2]) matches argv[3], your .joverc should read as follows:
>
>if checkenv TERM vt100
>set meta-key off
>set allow-^S-and-^Q off
>bind-to-key ansi-codes ESC O
>else
>bind-to-key ansi-codes ESC [
>endif


You could go through all this pain, or you could just put both in
the .joverc.  That is,
	bind-to-key ansi-codes ESC [
	bind-to-key ansi-codes ESC O
in the .joverc and not mess with that stupid kludge (called a feature)
that I implemented when I was feeling real dumb.  I tell you, the urge
to write a simple lisp interpreter is so great (!!!) ... but then we'd
end up with two gnu's, and that would be exactly one too many, right?

Jonathan Payne
	
P.S.  But I DIDN'T write the ansi-codes kludge - I just gave in to
pressure and put it in the official version.  I've been meaning to
implement real keymaps, except that I just don't need them because I
don't believe in function keys...

rjg@hcr.UUCP (Bob Gibson) (05/17/88)

In article <146@isl.stanford.edu> wongpw@isl.UUCP (Ping Wah Wong) writes:
| 
| If I use several different terminals, how do I tell jove (supposedly
| through the .joverc file) to interpret the cursor and function keys
| correctly? Thanks in advance!
| 
| Ping (wongpw@isl.stanford.edu)

I include all my terminal independent key bindings in my .joverc and
use the "source" command to source a different file of terminal
dependent key bindings for each terminal I work with according to my
$TERM variable.  This is done in my .joverc with the following line:
	source ~/jove/term/$TERM
where ~/jove/term is a directory of jove "terminal descriptions".  For
example, If I logged in on a vt100, I would set my TERM environment
variable to vt100 in my .profile, which would then instruct JOVE to
source ~/jove/term/vt100.  You will probably also need to
"set expand-environment-variables on" first.

A word of warning: on previous versions of JOVE, I have found that the
source command must be the last line in your .joverc.  I have not
checked this out for version 4.9.  Also, I use JOVE on System V, and
some of the above details may be slightly different for other
systems.

-- 
Bob Gibson         {utzoo,utcsri}!hcr!rjg
HCR Corporation    (416) 922-1937

jpayne@cs.rochester.edu (Jonathan Payne) (05/19/88)

In article <3337@hcr.UUCP> rjg@hcr.UUCP (Bob Gibson) writes:
|$TERM variable.  This is done in my .joverc with the following line:
|	source ~/jove/term/$TERM
|where ~/jove/term is a directory of jove "terminal descriptions".  For
|
|A word of warning: on previous versions of JOVE, I have found that the
|source command must be the last line in your .joverc.  I have not
|checked this out for version 4.9.  Also, I use JOVE on System V, and
|some of the above details may be slightly different for other
|systems.

I like that idea!  Anyway, don't worry about the position of the source
command in the .joverc.  I fixed that a while ago ...

allbery@ncoast.UUCP (Brandon S. Allbery) (05/21/88)

As quoted from <146@isl.stanford.edu> by wongpw@isl.Stanford.EDU (Ping Wah Wong):
+---------------
| If I use several different terminals, how do I tell jove (supposedly
| through the .joverc file) to interpret the cursor and function keys
| correctly? Thanks in advance!
+---------------

Install this shell script somewhere on your path:

------- isterm -------
test "x$TERM" = "x$1"
----------------------

Then you can put conditional code in your .joverc:

if isterm vt100
	bind-to-key ansi-codes ^[[
endif
if isterm sun
	bind-to-key ansi-codes ^[O
endif

I'm thinking about adding a slightly smarter if command, but that will have
to be after all the other projects in my queue.
-- 
	      Brandon S. Allbery, moderator of comp.sources.misc
	{well!hoptoad,uunet!marque,cbosgd,sun!mandrill}!ncoast!allbery
Delphi: ALLBERY						     MCI Mail: BALLBERY