我的操作系统是Debian Squeeze。以下是vim版本:
VIM - Vi改进版7.2(2008年8月9日,编译于2010年7月12日02:29:33)
我阅读了http://kovisoft.bitbucket.org/tutorial.html上的教程并尝试启动MIT-Scheme的REPL。不幸的是,我无法启动。
当我按下“,c”时,它会启动一个终端窗口来加载mit-scheme。在vim的REPL缓冲区中没有显示任何内容。终端中显示了一些错误。
我重新尝试了,但出现了一些新的问题。
这里是日志文件(swank.log)。
这是数据包:
VIM - Vi改进版7.2(2008年8月9日,编译于2010年7月12日02:29:33)
我阅读了http://kovisoft.bitbucket.org/tutorial.html上的教程并尝试启动MIT-Scheme的REPL。不幸的是,我无法启动。
当我按下“,c”时,它会启动一个终端窗口来加载mit-scheme。在vim的REPL缓冲区中没有显示任何内容。终端中显示了一些错误。
Listening on port: 4005
;netcat: "4005: inverse host lookup failed: Unknown host"
;To continue, call RESTART with an option number:
; (RESTART 1) => Return to read-eval-print level 1.
2 error>
我阅读了源代码并修复了一些错误(关于netcat的参数和其他一些内容),这是差异文件:
*** /home/gaussfrank/slimv/slime/contrib/swank-mit-scheme.scm 2012-02-02 16:41:58.357463955 +0800
--- swank-mit-scheme.scm 2012-02-06 22:30:42.929212874 +0800
***************
*** 113,126 ****
(define (netcat port)
(let* ((sh (os/shell-file-name))
! (cmd (format #f "exec netcat -v -q 0 -l ~a 2>&1" port))
(netcat (start-pipe-subprocess sh
(vector sh "-c" cmd)
scheme-subprocess-environment)))
(list netcat port)))
(define (netcat-accept nc)
! (let* ((rx "^Connection from .+ port .+ accepted$")
(line (read-line (subprocess-input-port nc)))
(match (re-string-match rx line)))
(cond ((not match) (error "netcat:" line))
--- 113,126 ----
(define (netcat port)
(let* ((sh (os/shell-file-name))
! (cmd (format #f "exec netcat -v -q 0 -l -p ~a 2>&1" port))
(netcat (start-pipe-subprocess sh
(vector sh "-c" cmd)
scheme-subprocess-environment)))
(list netcat port)))
(define (netcat-accept nc)
! (let* ((rx "^listening on.*")
(line (read-line (subprocess-input-port nc)))
(match (re-string-match rx line)))
(cond ((not match) (error "netcat:" line))
我重新尝试了,但出现了一些新的问题。
;The object #f, passed as the second argument to integer-add, is not the correct type.
;To continue, call RESTART with an option number:
; (RESTART 4) => Specify an argument to use in its place.
; (RESTART 3) => Return to SLIME top-level.
; (RESTART 2) => Close connection.
; (RESTART 1) => Return to read-eval-print level 1.
这里是日志文件(swank.log)。
[---Sent---] 0.21
(:emacs-rex (swank:connection-info) nil t 1)
[---Sent---] 16.11
(:emacs-rex (swank:swank-require 'swank-fuzzy) nil t 2)
这是数据包:
8 0.739991 127.0.0.1 127.0.0.1 TCP 50732 > pxc-pin [PSH, ACK] Seq=1 Ack=1 Win=32792 Len=51 TSV=1451459 TSER=1451459
0000 00 00 00 00 00 00 00 00 00 00 00 00 08 00 45 00 ..............E.
0010 00 67 91 53 40 00 40 06 ab 3b 7f 00 00 01 7f 00 .g.S@.@..;......
0020 00 01 c6 2c 0f a5 f9 57 b4 93 fc 40 7f 85 80 18 ...,...W...@....
0030 10 03 fe 5b 00 00 01 01 08 0a 00 16 25 c3 00 16 ...[........%...
0040 25 c3 30 30 30 30 32 64 28 3a 65 6d 61 63 73 2d %.00002d(:emacs-
0050 72 65 78 20 28 73 77 61 6e 6b 3a 63 6f 6e 6e 65 rex (swank:conne
0060 63 74 69 6f 6e 2d 69 6e 66 6f 29 20 6e 69 6c 20 ction-info) nil
0070 74 20 31 29 0a t 1).
9 0.740009 127.0.0.1 127.0.0.1 TCP pxc-pin > 50732 [ACK] Seq=1 Ack=52 Win=32768 Len=0 TSV=1451459 TSER=1451459
0000 00 00 00 00 00 00 00 00 00 00 00 00 08 00 45 00 ..............E.
0010 00 34 5a 46 40 00 40 06 e2 7b 7f 00 00 01 7f 00 .4ZF@.@..{......
0020 00 01 0f a5 c6 2c fc 40 7f 85 f9 57 b4 c6 80 10 .....,.@...W....
0030 10 00 fe 28 00 00 01 01 08 0a 00 16 25 c3 00 16 ...(........%...
0040 25 c3 %.
.vimrc
中添加以下内容:let g:swank_log=1
。这将使slimv创建一个日志文件,记录slimv和swank服务器之间的通信。请将日志文件发送给我(我是slimv的作者)进行分析。您描述的错误(在函数read-length中)表明解码消息长度存在问题。您知道,swank消息包含6个十六进制数字的消息长度,然后是消息本身。 - Tamas Kovacs