[comp.editors] Arrowkeys for Jove

c60a-4dc@WEB.berkeley.edu (09/08/89)

	Though I know the flexibility and power, I have kept from using Jove 
for my editor; I use Emacs on Xwindow and I prepare texts on any Mac editors
and send when on modem.  And the single reason is, Jove originally doesn't bind
arrow key!
	It is so painful that makes me feel Jove is not worth it despite its
power.  And I tried bind arrow keys for vt100 by modifying .joverc and as you
guessed, failed.  First I added the following:

bind-to-key previous-line ^[[A
bind-to-key next-line ^[[B
bind-to-key forward-character ^[[C
bind-to-key backward-character ^[[D

And when trying to use arrow keys, it beeps, and returns "ESC-0 not bound" on
the command line.  So I took a look at cmd.doc and found a following:
 
 :entry "bind-keymap-to-key" "Command"
This is the way to build  nested  keymaps.   For  example,  when  JOVE
starts up, internally it does a

     bind-keymap-to-key ESC-map ^[

To make the arrow keys on vt100's work, you would do the following.

     make-keymap vt100-map
     bind-keymap-to-key vt100-map ^[[
     bind-to-key next-line ^[[A
     bind-to-key previous-line ^[[B
     bind-to-key forward-character ^[[C
     bind-to-key backward-character ^[[D

I may have gotten the escape sequences wrong, but you get the  general
idea.   Theoretically  you  can  use these keymaps to bind arbitrarily
long key sequences, like those generated by  the  SUN  keyboards,  but
that  is  a bit of a pain because you will have to generate a bunch of
keymaps by hand, almost one per key, because of the way  the  key  se-
quences are organized.  Eventually there will be a more general way to
have these keymaps built for you.

	I pasted above setting in .joverc and tried again.  And failed in the
same manner as I explained in previous case.
	Studying the last trial, I modified above example to the following:

make-keymap vtup
make-keymap vtdown
make-keymap vtr
make-keymap vtl
bind-keymap-to-key vtup ^[[A
bind-keymap-to-key vtdown ^[[B
bind-keymap-to-key vtr ^[[C
bind-keymap-to-key vtl ^[[D
bind-to-key previous-line ^[[A
bind-to-key next-line ^[[B
bind-to-key forward-character ^[[C
bind-to-key backward-character ^[[D

	And again I failed--in the exact manner as I got for last cases.  Is it
impossible to make my dream come true?  Any info is welcome.  If you know more
than I need, please also tell me if it is possible to write a conditional jump
like .emacs?  I love Emacs and it is even more powerful but sometimes I don't
want to open new window for Emacs just to write a short messages.  If
conditional jump is possible, I can maybe find the way to find bind sun arrow
keys provided I will come to know how to bind vt100 arrow keys.  Thank you in
advance.
 
Dan Kogai
c60a-1kb@web.berkeley.edu
USMail:		1730 Laloma #1G Berkeley CA 94709
PacBell:	415-549-6106

	

jpayne%flam@Sun.COM (Jonathan Payne) (09/09/89)

In article <1989Sep8.022556.21527@agate.uucp> c60a-4dc@WEB.berkeley.edu () writes:
>
>	Though I know the flexibility and power, I have kept from using Jove 
>for my editor; I use Emacs on Xwindow and I prepare texts on any Mac editors
>and send when on modem.  And the single reason is, Jove originally doesn't bind
>arrow key!
>	It is so painful that makes me feel Jove is not worth it despite its
>power.  And I tried bind arrow keys for vt100 by modifying .joverc and as you
>guessed, failed.  First I added the following:
>
>And when trying to use arrow keys, it beeps, and returns "ESC-0 not bound" on
>the command line.  So I took a look at cmd.doc and found a following:
> 

"ESC O not bound" should have been the give-away.  Your arrow-keys are
generating ^[Ox, not ^[[x.

JOVE isn't as powerful as emacs.  But it's fast and small and does most
of the things in a reasonable way.  The latest version has the following
in the system-wide initialization file:

    make-keymap ansi-codes
    bind-keymap-to-key ansi-codes ^[[
    bind-keymap-to-key ansi-codes ^[O
    bind-to-key previous-line ^[[A
    bind-to-key next-line ^[[B
    bind-to-key forward-character ^[[C
    bind-to-key backward-character ^[[D

It creates a keymap called ansi-codes and binds that keymap to two
differernt keys, "ESC [" and "ESC O".  Then it binds the commands as you
would like.  NOTE: Binding with the sequence ^[[x binds it for ^[Ox as
well, since they are sharing the ansi-codes map.

You are right, it is a pain to bind arbitary sequences like those
generated from the sun keyboards.  Fortunately for me I hate function
keys about as much as I hate arrow keys.  The reason the arrow keys
haven't been bound in the past is that I wanted to discourage people from
using them.  It's much better and faster to use the ^U command to move
around in big chunks.  There is no substitute for ^U^U^N or ^U^U^F, there
really isn't.  In this day and age everyone has a work station on his or
her desk, so the machine can keep up with people holding down the arrow
keys.

Whatever.