When you want to load swank without going through the normal, Emacs based, process just load the swank-loader.lisp file. Just execute
(load "/path/to/swank-loader.lisp") (swank-loader:init)
inside a running lisp image2. Now all we need to do is startup our swank server. The first example assumes we’re using the default settings.
Since we’re going to be tunneling our connection via ssh3 and we’ll only have one port open we want to tell swank to not use an extra connection for output (this is actually the default in current SLIME):
(setf swank:*use-dedicated-output-stream* nil)
If you need to do anything particular
(like be able to reconnect to swank after you’re done), look into
swank:create-server’s other arguments. Some of these arguments
Port number for the server to listen on (default: 4005).
See See Communication style.
Boolean indicating if the server will continue to accept connections
after the first one (default:
NIL). For “long-running” lisp processes
to which you want to be able to connect from time to time,
String designating the encoding to be used to communicate between the Emacs and Lisp.
So the more complete example will be
(swank:create-server :port 4005 :dont-close t :coding-system "utf-8-unix")
On the emacs side you will use something like
(setq slime-net-coding-system 'utf-8-unix) (slime-connect "localhost" 4005))
to connect to this lisp image from the same machine.
SLIME also provides an ASDF system definition which does the same thing
there is a way to connect without an ssh tunnel, but it has the side-effect of giving the entire world access to your lisp image, so we’re not going to talk about it