您的位置:首页 > 其它

emacs 配置erlang 开发环境~

2011-10-19 17:07 531 查看
erlang用什么开发工具?看看erlang官方带了什么扩展?emacs !

(里面出现的插件名字,自己搜索,还有路径用自己路径)
上图先。 dp的emacs 哈~





配置 Erlang mode + distel:

;; Erlang mode
(setq load-path (cons  "<Erlang OTP 安装路径>/lib/tools-<版本号>/emacs"
load-path))
(setq erlang-root-dir "<Erlang OTP 安装路径>")
(setq exec-path (cons "<Erlang OTP 安装路径>/bin" exec-path))
(require 'erlang-start)

;; This is needed for Distel setup
(let ((distel-dir "<Distel 解压位置的路径>/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))))


Distel 设置断点可能会有问题,需要注释掉 <Distel 路径>/elisp/edb.el 的两行代码:

;;  (unless (edb-module-interpreted-p module)
;;    (error "Module is not interpreted, can't set breakpoints."))


二、给 Emacs 增加行号:

编辑 .emacs 添加配置:

(require 'linum)
(global-linum-mode 1)


三、autocomplete

下载 auto-complete :http://cx4a.org/software/auto-complete/#Latest_Stable

随便解压个什么地方

打开 Emacs,输入 M-x load-file RET <Autocomplete 解压路径>/etc/install.el RET

如果你没有改 Emacs 什么设置的话,这个操作是这样:Alt + x,注意窗口最下面一行会有一个黄底的 M-x 突出显示出来,并且光标会自动移到 M-x 后面,输入load-file,回车,输入 <Autocomplete 解压路径>/etc/install.el 回车

接着是输入安装路径,默认是 ~/.emacs.d,也不用改了..直接回车吧

.emcs.d 目录和 .emacs 文件是在同一路径下

编辑 .emacs 添加:

(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)))))

(add-to-list 'load-path "~/.emacs.d/")
(require 'auto-complete-config)
(add-to-list 'ac-dictionary-directories "~/.emacs.d//ac-dict")
(ac-config-default)


四、eflymake

下载最新的 Flymake:http://sourceforge.net/projects/flymake/

将 .el 文件解压到 ~/.emacs.d/ 下,注意别带路径过去

编辑 .emacs 添加:

(require 'erlang-flymake)


五、yasnippet

下载最新的 yasnippet-bundle:http://code.google.com/p/yasnippet/

把 yasnippet-bundle.el 解压到 ~/.emacs.d/

(require 'yasnippet-bundle)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: