Marco Baringer mb@bese.it writes:
David Steuber david@david-steuber.com writes:
Anyone have any recipes for doing this? It seems like something that people would do.
run (swank:create-server 0) in the lisp image, this will return a port number (if you want a porticular port pass that to create-server instead of 0). Use M-x slime-connect to connect to that host and port, you'll need to set up an ssh tunnel if your doing this remotely and want it encrypted. the way things are currently structured the server created can only be used once, once you do a slime-disconnect you'll need to start a new serve in the app to be able to connect again.
Is there a way around this one connection limitation? So far, the only thing that worked for me was to run attachtty to get into my app and re-run (swank:create-server 4005) as you said. I don't know how to put this in a shell script which would make it a little better.
It would be very nice to be able to reuse the server connection. How hard would this be? What are the security implications of doing this? It seems that another user on the system can connect to a swank server.
It's not really feasable for me to remain connected all the time, otherwise I wouldn't worry about it. My current workflow is something like this:
ssh -X myserver
run this schell script:
#!/bin/sh
# # Start SBCL as a detachtty process and start listening to Apache #
rm /home/david/usr/var/run/* 2>/dev/null
export SBCL_HOME=/home/david/usr/lib/sbcl
/usr/bin/detachtty --dribble-file /home/david/usr/var/run/lisp-dribble \ --log-file /home/david/usr/var/run/detachtty.log \ --pid-file /home/david/usr/var/run/lisp.pid \ /home/david/usr/var/run/lisp-socket \ /home/david/usr/bin/sbcl \ --eval '(ml:modlisp-start :port 3000)' \ --eval '(swank:create-swank-server 4005)'
My SBCL has this in its sbclrc file:
(require :asdf) (require :asdf-install) (asdf:operate 'asdf:load-op 'modlisp) (asdf:operate 'asdf:load-op 'cl-ppcre) (asdf:operate 'asdf:load-op 'lml2) (asdf:operate 'asdf:load-op 'swank)
At this point, Apache can talk to my Lisp image. So far nothing interesting is done. I just have the mod_lisp debug page returned for any arbitrary request (well, at least GET requests).
I can also now start up Emacs and do M-x slime-connect. As you said, once I do M-x slime-disconnect, that is that.
I've also been sent this code by Tim Lavoie which I have in my .emacs file:
(defun slime-sbclremote () "connect to sbcl already running with detachtty" (interactive) (let ((inferior-lisp-program "attachtty /home/david/usr/var/run/lisp-socket") (coding-system-for-read 'us-ascii-dos)) (slime)))
It also is subject to a one time use limit once I do M-x slime-disconnect.
I don't get to use each of them once. It is either/or.
I expect that in the near term, what I have is good enough. It's not like I have to enter a running Lisp at any time to fix it. Not yet. Down the road, I can see that being a good thing to be able to do. If I knew how to do it right now, I would send a patch.