about distel
September 21st, 2007 :: KrzyCube
貌似不少人都碰上distel 的 node down的问题. 干脆我注册个号来发一帖.
我这边碰上过这个问题,之后查明原因是因为 node name的问题, 直接给localhost死活不认,只好给它设各名字,在.emacs里加elisp代码,让emacs中erlang起来的时候就设置一个名字,然后connect to node的时候连到这个就可以了. 或者 直接 erl -sname xxx 也可以
另外connect to remote node的时候,需要给两个node设置 相同的cookie,不然会disallow (或者别的什么东西). 用 erl -setcookie 这个我没写到elisp里,需要用的时候手动跑好了. 下面贴下我的distel setup吧.
erlang-mode 的安装就不提了.
下载: distel.el
- ;distel
- (add-to-list 'load-path "/home/yuxihe/src/distel/elisp")
- (when (locate-library "distel")
- (require 'distel)
- (distel-setup)
- (add-hook 'erlang-mode-hook
- '(lambda ()
- (unless erl-nodename-cache
- (distel-load-shell))))
- (defun distel-load-shell ()
- "Load/reload the erlang shell connection to a distel node"
- (interactive)
- ;; Set default distel node name
- (setq erl-nodename-cache 'distel@localhost)
- (setq distel-modeline-node "distel")
- (force-mode-line-update)
- ;; Start up an inferior erlang with node name `distel'
- (let ((file-buffer (current-buffer))
- (file-window (selected-window)))
- (setq inferior-erlang-machine-options '("-sname" "distel"))
- (switch-to-buffer-other-window file-buffer)
- (inferior-erlang)
- (select-window file-window)
- (switch-to-buffer file-buffer))))
如果还是node down,可以试试把这个改成
- (setq inferior-erlang-machine-options '("-sname" "distel@localhost")).
这样就跟上面的node -cache-name 匹配了.
另外,我在windows下使用distel有些问题,linux下表现良好, 报一个诡异的错误,发到maillist得知人家也有些碰上这个问题,不过他们是在 utf-8 branch的emacs上碰到问题,我是在binary release的22.1下有问题.
尝试改了下derl.el的代码,没解决,郁闷死.
我是按照这个里面的配置的
http://bc.tech.coop/blog/070528.html
没有什么问题呀, 我的是ubuntu 7.04 +emacs 22.
呵呵,给你改了 coolcode 又给你改回去了。两次!晕死!
现在来改第三次。
修改方法见: http://erlang-china.org/help
能不能把内容面板搞宽点, 现在这样忒窄了,义行看不了几个字.即便考虑通用性,现在用640*480显示器的人应该很罕见了吧.
@krzycube 用的是 wordpress 换个 theme?当前这个破效果,改了不少东西,考虑-ing。
@krzycube
嗯,按照你这个,配置 distel 成功了。严重感谢。
krzycube 的这个 el ,和 http://bc.tech.coop/blog/070528.html 的相比,主要的区别在与:直接启动了 erlang 的 shell 省去了自己去手工启动和连接 erlang node 的麻烦,省事不少。
我是在xp sp3下的,emacs= 23.0.60.1 (i386-mingw-nt5.1.2600),distel http://groups.google.com/group/erlang-china/browse_thread/thread/303e1291b86a0071 这个。每次在菜单里运行:list all erlang processes 总是返回: (error “Can’t handle event closed in state derl-recv-challenge-ack”),在emacs 的erlang的界面上就看到: Connection attempt from disallowed node ‘distel_3844@LIWOOOOD-3FD36A’ ** ,很奇怪的是distel后边每次都会自动加上了不同的数字。
我的配置是参照 http://erlang-china.org/study/about-distel.html,
呵呵,打错了,应该是distel是从http://groups.google.com/group/erlang-china/browse_thread/thread/303e1291b86a0071下载的
环境
emacs=23.0.0.1
os = xp sp3
.emacs 配置抄用 http://bc.tech.coop/blog/070528.html
—————————–
实际状况
emacs:
error “Can’t handle event closed in state derl-recv-challenge-ack
emacs erlang:
Connection attempt from disallowed node ‘distel_3844@LIWOOOOD-3FD36A’ **
问题:
通常两种问题 1. cookie 不匹配 2. node name 不匹配
排查问题:
首先排查第一个问题:
查看在emacs 中和erlang中是否调用同一个cookie配置文件. 默认情况下是检查
home 目录下的 .erlang.cookie.
1. elrang 中通过 init:get_argument(home). 找到位置 “c:/Document …/Admini..”,
2 emacs 中cookie 可通过变量 derl-cookie 查看. 结果:
Its value is nil
但有这么一句
When NIL, we read ~/.erlang.cookie.
mmd 我想知道问题了,
C:\>env | grep HOME
HOME=d:\emacs
HOMEDRIVE=C:
HOMEPATH=\Documents and Settings\Administrator
问题总结:
在windows下 emacs 调用的home目录是 HOME. 而在erlang所依赖的home 目录是HOMEPATH. 两个调用的 .erlang.cookie 位置不一样
解决:
1. cp “c:/Documents and …/Administ../.erlang.cookie” d:/emacs
2. 在erlang 端 -setcookie cookie ,
在emacs中(setq derl-cookie “cookie”)
参考:
http://osdir.com/ml/lang.erlang.distel.devel/2003-02/msg00001.html