Jason Lee
unread,Jul 15, 2008, 9:30:40 AM7/15/08Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Erlang China
刚开如学习Erlang, 花了点时间在Emacs下面配置了一点, 觉得还挺好的. 把经验和大家分享一下, 特别在想在Windows下面用
Emacs+Distel的.
我是在Windows下面配置的,好像LINUX下更容易.
1. 安装一个Win32下的Emacs. 我用的是EmacsW32, 因为比较新.
2. 安装Erlang,我就不多说了.
3. 修改.emacs,在后面加上:
=================================
(setq erlang-root-dir "d:/Progra~1/erl5.6.3")
(setq load-path (cons "d:/Progra~1/erl5.6.3/lib/tools-2.6.1/emacs"
load-path))
(setq exec-path (cons "d:/Progra~1/erl5.6.3/bin" exec-path))
(require 'erlang-start)
=================================
(NOTE: d:/Progra~1/erl5.6.3.是安装erlang的dir. 最好用Progra~1,不要加上有空格的路径.)
4. 解压附件里的distel(我自己编译的),再修改.emacs, 加上如下配置(从网上找来的).其中e:/distel-read-
only/elisp是distel的路径.
=================================
; This is needed for Distel setup
(let ((distel-dir "e:/distel-read-only/elisp"))
(unless (member distel-dir load-path)
;; Add distel-dir to the end of load-path
(setq load-path (append load-path (list distel-dir)))))
(require 'distel)
(distel-setup)
;; Some Erlang customizations
(add-hook 'erlang-mode-hook
(lambda ()
;; when starting an Erlang shell in Emacs, default in the node
name
(setq inferior-erlang-machine-options '("-sname" "emacs"))
;; add Erlang functions to an imenu menu
(imenu-add-to-menubar "imenu")))
;; A number of the erlang-extended-mode key bindings are useful in the
shell too
(defconst distel-shell-keys
'(("\C-\M-i" erl-complete)
("\M-?" erl-complete)
("\M-." erl-find-source-under-point)
("\M-," erl-find-source-unwind)
("\M-*" erl-find-source-unwind)
)
"Additional keys to bind when in Erlang shell.")
(add-hook 'erlang-shell-mode-hook
(lambda ()
;; add some Distel bindings to the Erlang shell
(dolist (spec distel-shell-keys)
(define-key erlang-shell-mode-map (car spec) (cadr spec)))))
=========================================
5. 根据Distel的Install.Win32安装. 在C:根目录下,新建文件.erlang和.erlang.cookie.内容分别是:
.erlang(就一句, 注意路径.)
code:add_pathz("E:/distel-read-only/ebin").
.erlang.cookie的内容随意, 如.
this_is_my_secret
6. 运行
其实安装erlang的时候就已经有了对其语言的支持,目前也是我最常用的.
Distel可提供更强的功能. 但要先启动erlang, 我也只是初学, 不是很了解, 方法如下:
1) 运行emacs.
2) 打开一个shell(如cmd, msys)
3) 运行erl -sname emacs, 启动erlang的一个服务.
4) 然后就可用Distel了.
只是初学, 花了点时间配置了一下, 用问题大家多交流.