天天看點

關于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!

繼續閱讀