[slime-devel] Re: Port File and Dedicated SLIME Instance

Helmut Eller heller at common-lisp.net
Fri Aug 15 17:01:26 UTC 2008


* Volkan YAZICI [2008-08-15 16:25+0200] writes:

> But this time evaluation enters into `custom-slime-connect', executes
> `(run-with-timer ...)' expression, *Messages* display `Connecting to
> Swank on port 4005...' lines (2 times) and nothing happens. Would you
> mind helping me to spot the problem?

You could do something like this:

(setq slime-lisp-implementations
 `((sbcl-4005 
    ("sbcl")
    :init 
    (lambda (port-file _encoding)
      (let ((form `(swank::setup-server 
                    4005 (lambda (port)
                           (swank::announce-server-port ,port-file port))
                    :spawn t
                    (swank::find-external-format-or-lose"latin-1-unix"))))
        (format 
         "%S\n\n"
         `(progn
            (load ,(expand-file-name "swank-loader.lisp" slime-path)
                  :verbose t)
            (funcall (read-from-string "swank-loader:init"))
            (eval (read-from-string ,(prin1-to-string form))))))))

Then you can start it with `M- M-x slime sbcl-4005'.

> Furthermore, in the *inferior-lisp* buffer started by `inferior-lisp'
> command, after every expression I evaluate in *inferior-lisp* buffer, it
> displays
>
>   ;; SWANK: sb-thread::get-foreground ...
>
> in the *inferior-lisp* buffer and the steps into the prompt. Is that
> something expected?

That's a debug message. I can remove that.

> BTW, I'm quite suprised that almost everybody is satisfied with the
> current close-socket-on-client-disconnects behavior. 

Keep in mind that there are two kinds of sockets.  The "server socket"
which accepts the connection and the "client socket" which is the actual
communication channel.  In absence of the :dont-close argument, we close
the server socket after the first connection just to close one of the
many security holes.  Keeping the client socket open after Emacs
disconnects is meaningless, as by then there's nobody to talk to.

I guess that most people start long running Lisp process in Screen or
something like that and not from within Emacs.

> My client
> disconnects from the inferior lisp image nearly two or three times a
> day. (I suspect this is because of non-latin characters, despite my
> coding-system set to "utf-8-unix".)

In this case, there should be an error message either in the
*inferior-lisp* buffer of the *Messages* buffer.

> And because of I cannot reconnect, I
> need to start SLIME from scratch, which is quite irritating. IMHO, it'd
> awesome if it'd be possible to start a dedicated swank server easily in
> SLIME.

If the *inferior-lisp* process is still running, and you do `M-x slime'
then SLIME usually asks: "Create an additional *inferior-lisp*? (y or
n)" If you answer yes, the same Lisp process opens a new server socket
and lets Emacs reconnect.  There are some bugs, it seems to work for the
first connection but not for multiple concurrent connections.

Adding a fixed port number to slime-lisp-implementations would be easy
but not very useful.  I guess we could add something like `C-u
PORT-NUMBER M-x slime', but I doubt that enough people need that to
justify the added complexity for `M-x slime'.

Helmut.




More information about the slime-devel mailing list