Using arrow keys under Linux -- has anyone any advice?

P B

Using arrow keys under Linux -- has anyone any advice?

Reply Threaded More More options
Print post
Permalink
Some javascript/style in this post has been disabled (why?)
Hi,

Does someone know what I need to do to set the arrow keys (and in fact the other keys) on Linux? When I load abcl.jar into an xterm window the arrow keys don't respond correctly:

Armed Bear Common Lisp 0.12.0
Java 1.6.0 IBM Corporation
IBM J9 VM
Low-level initialization completed in 0.718 seconds.
Startup completed in 2.411 seconds.
Type ":help" for a list of available commands.
CL-USER(1): ^[[A^[[C^[[B^[[D

Up, right, down and left are shown above. I used java -jar abcl.jar to launch this.

(Of course this all works fine in Windows, but I'm not an X wizz, so I don't know if this is straight forward or not.)

If you run abcl.jar under Windows it all works fine. By that I mean the arrow keys work as expected at the command prompt (CMD.EXE), and once you've started ABCL (java -jar abcl.jar) the Lisp prompt lets you move in each direction, with left and right moving along the current line, and up getting the previous command in the history, and down getting the next command.

Now within Linux I can start an xterm session. I don't use any options. The TERM variable is set to xterm, which is what I expect. At the command prompt I can use left and right to move around the current command, and up and down to navigate the command history of the shell.

When I start ABCL as in Windows, the benefits I had from the command line now disappear. I assume this is because within the Java code it does not handle the key commands as shown in my previous post (ESC-A, ESC-B, etc).

Trawling through the Java code it seems that the command prompt is run using Lisp code (top-level.lisp). Does this mean the error is within the Lisp code or the Java code?

Phil


------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
armedbear-j-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/armedbear-j-devel
Julian Fondren

Re: Using arrow keys under Linux -- has anyone any advice?

Reply Threaded More More options
Print post
Permalink
> Does someone know what I need to do to set the arrow keys (and in fact the
> other keys) on Linux? When I load abcl.jar into an xterm window the arrow
> keys don't respond correctly:
>
> Armed Bear Common Lisp 0.12.0
> Java 1.6.0 IBM Corporation
> IBM J9 VM
> Low-level initialization completed in 0.718 seconds.
> Startup completed in 2.411 seconds.
> Type ":help" for a list of available commands.
> CL-USER(1): ^[[A^[[C^[[B^[[D

1. Install rlwrap.

2. Put this script (derived from abcl.wrapper) in your PATH -- ~/bin
is a good place.

#!/bin/sh
ABCL='/usr/local/jdk-1.6.0/jre/bin/java -server -Xrs
-Djava.library.path=/opt/julian/lisp/in/abcl/src/or
g/armedbear/lisp/libabcl.so -cp /opt/julian/lisp/in/abcl/dist/abcl.jar
org.armedbear.lisp.Main'
if [ $# -eq 0 ]; then
 exec rlwrap -b "[]()'\" " --remember -c -f ~/.abcl_completions -H
~/.abcl_history -s 1000000 $ABCL
else
 exec $ABCL "$@"
fi

You may want to limit ~/.abcl_history to less than one million entries :-)

3. Generate ~/.abcl_completions
(let (symbols)
 (do-all-symbols (sym)
   (let ((package (symbol-package sym)))
     (cond
       ((not (fboundp sym)))
       ((or (eql #.(find-package :cl) package)
            (eql #.(find-package :extensions) package)
            (eql #.(find-package :cl-user) package))
        (pushnew (symbol-name sym) symbols))
       ((eql #.(find-package :keyword) package)
        (pushnew (concatenate 'string ":" (symbol-name sym)) symbols))
       (package
         (pushnew (concatenate 'string (package-name package)
                              ":"
                              (symbol-name sym))
                 symbols)))))
 (with-open-file (output #.(concatenate 'string (getenv "HOME")
                                        "/.abcl_completions")
                         :direction :output :if-exists :overwrite
                         :if-does-not-exist :create)
   (format output "~{~(~A~)~%~}" (sort symbols #'string<))))

HTH
Julian

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
armedbear-j-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/armedbear-j-devel