天天看点

关于swank started at port的解答1

在配置Common Lisp开发环境时,无论是lisp in a box或者Emacs+SBCL+Slime时都会出现一个报错:

swank started  at port :

其实在我一台没有联网的电脑上运行lisp in a box上却没有出现问题,目前出问题的电脑使用的是公司的代理服务器,我怀疑出现问题的网络设置有很大关系,因为同样配置的电脑差异只是有没有联网。

搜遍网络只有一篇英文,复制英文的原因很简单,自己看着方便,万一英文网站被和谐嘛。

引用如下:

http://stackoverflow.com/questions/12650082/about-stumpwm-and-swankclisp

I have built stumpwm using thread enabled clisp successfully. And the created stumpwm works great. However, the swank server doesnot work if started from ~/.stumpwmrc as below:

(load  "~/.vim/slime/start-swank.lisp")
           

The swank server is indeed started as 

netstat -na

 shows it is lisening on port 4005. But 

telnet 127.0.0.1 4005

 will report "connection is closed by peer". So that the slimv in VIM cannot connect to swank server.

If i start another clisp REPL and run 

(load "~/.vim/slime/start-swank.lisp")

, then both telnet and slimv works ok.

Why doesnot 

(load "~/.vim/slime/start-swank.lisp")

 in ~/.stumpwmrc work ?

FYI, The stumpwm log:

Starting swank on port 4005
 ;;  Loading file /home/***/.vim/slime/start-swank.lisp ...
 ;;  Loading file /home/***/.vim/slime/swank-loader.lisp ...
 ;;  Loaded file /home/***/.vim/slime/swank-loader.lisp
 ;;   Loading file /home/***/.slime/fasl/2012-03-06/clisp-2.49-unix-pc386/swank-backend.fas ...
 ;;  ...
 ;;   Loaded file /home/***/.slime/fasl/2012-03-06/clisp-2.49-unix-pc386/contrib/swank-mrepl.fas
 ;; Swank started at port: 4005.
           

It seems ok but i cannot use stumpwm anymore !

I'm not familiar with slimv, but it seems that all you're looking to do is start a server in lisp and connect to it. Keep it simple. As I don't really want to find out too much about what's going on in 

start-swank.lisp

, and you probably don't either, I would recommend you start a swank server by putting this in your .stumpwmrc:
(ql:quickload "swank")
(swank:create-server :port #<choose a port number>)
           
Then connect on that port number with slimv's equivalent of 

M-x slime-connect

. If the version of swank in quicklisp is not compatible with slimv, make sure you have one that is, and 

REQUIRE

 it.

Try it out and, if it still doesn't work, look at the version numbers of swank and slimv and post your findings.

From the clisp mailing list, i got a suggestion: We should modify ~/.vim/slime/swank-clisp as below:

(defimplementation preferred-communication-style () :spawn)
           
After running 

(load "~/.vim/slime/start-swank.lisp")

 to start swank server, the slimv can connect to swank server without any error.

Now slimv works great with clisp(with thread support) .

Regards!

继续阅读