* Leo [2011-08-04 18:16] writes:
On 2011-08-04 22:29 +0800, Helmut Eller wrote:
I assume you do something like
shell# rlwrap java7 -Xss450k -cp /opt/java/current/lib/tools.jar:/scratch/kawa -agentlib:jdwp=transport=dt_socket,server=y,suspend=n kawa.repl -s Listening for transport dt_socket at address: 39670 #|kawa:1|# (require "/home/helmut/lisp/slime/contrib/swank-kawa.scm") #|kawa:2|# (create-swank-server 4005)
This was exactly how I started swank. But it does not run in the background.
You could start it in a new thread: (future (create-swank-server 4005))
How to stop swank and go back to the REPL?
I never implemented a clean shutdown/restart. Restarting the whole JVM was mostly good enough for me (and is almost unavoidable from time to time).
Another issue I noticed is after leaving emacs idle for a while, surprisingly there appear out of nowhere two pending requests to the swank server. I can't figure out a way to restart the swank server without restarting kawa.
That could be a bug triggered by SPC and swank tries to find some arglist but somehow fails along the way.
It could also be a bug in JDI. Hard to say exactly.
My current setup is adding a 'kawa entry to 'slime-lisp-implementations and M-- M-x slime RET kawa RET (just like suggested in swank-kawa.scm).
This might be useful:
(defun kawa () (interactive) (slime 'kawa))
This way M-x kawa starts the 'kawa entry from slime-lisp-implementations.
But if I disconnect slime-repl (using the repl shortcut ,disconnect) from the inferior swank server, that seems to also stop the swank server.
So I eval in emacs
M-: (slime-inferior-connect (get-buffer-process (current-buffer)) \ (slime-inferior-lisp-args (get-buffer-process (current-buffer))))
to restart the swank server and have the slime-repl buffer open up again. This now works perfectly with your patch.
One inconvenience with the Kawa swank server is it does not respond to slime-interrupt. Is there a workaround?
slime-interrupt should work to some degree. E.g we can interrupt and continue this example:
(define (foo) (let loop () (loop))) (foo)
Sometimes it takes a long time until the JVM stops the thread. E.g.
(define (foo) (foo))
There may also be bugs in Swank that prevent it from working in some cases.
Helmut