之前配置了一次,Windows7崩溃了,今天重新配了一下总是配不好。上网找了些资料,终于搞定。
1、首先安装erlang (http://erlang.org 下载最新版本)一路next就可以;
2、安装emacs(解压到任意一个目录,运行addpm);
3、下载distel(http://sourceforge.net/projects/distel/ 这个的版本老,这里有新版本 http://code.google.com/p/distel/downloads/list),解压到任意目录;
4、要在系统的变量里增加以下变量:
ERL_HOME=E:/erl5.6.5 (erlang的按住功能目录)
PATH加入%ERL_HOME%/bin
HOME=E:/erlang(这个路径配置为erlang工程的目录)
5、在HOME目录下(上面配置系统变量中的那个)建立两个文件一个为.emacs(不知为何总是提示需要键入文件名,用_emacs也可以)
另一个是.erlang.cookie(内容任意)
6、.emacs的内容为:
;; erlang mode
(setq load-path (cons "c:/erl5.7.3/lib/tools-2.6.4/emacs" load-path))
(setq erlang-root-dir "c:/erl5.7.3/")
(setq exec-path (cons "c:/erl5.7.3/bin" exec-path))
(require 'erlang-start)
;; Distel 配置所需
(let ((distel-dir "c:/erl5.7.3/lib/distel-4.03/elisp")) (unless (member distel-dir load-path)
;; 加入distel-dir 到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" "distel_2036"))
;; 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)))))