Setting up the lisp image (SLIME User Manual, version 2.24)

Next: Setting up Emacs, Up: Connecting to a remote lisp [Contents][Index]

#### 7.1.1 Setting up the lisp image

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.

    (swank:create-server)

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 are

`:PORT`

  Port number for the server to listen on (default: 4005).

`:STYLE`

  See See Communication style.

`:DONT-CLOSE`

  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, specify `:dont-close t`

So the more complete example will be

    (swank:create-server :port 4005  :dont-close t)

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.

#### Footnotes

##### (2)

SLIME also provides an ASDF system definition which does the same thing

##### (3)

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