贴下官方的说明
distel -- Distributed Emacs Lisp for Erlang. ------------------------------------------------------------ Distel is a library for Emacs<->Erlang communication, plus a suite of tools built on top of it, such as a debugger front-end. It works by using the Erlang distribution protocol to connect Emacs with regular Erlang nodes, turning it into a very convenient user-interface toolkit. After the INSTALL procedure, you will have an extended Erlang mode any time you edit erlang files. You can see that this is enabled from the mode-line string "Erlang EXT", instead of just "Erlang". To see the available commands, use `describe-mode' (C-h m), which describes all the currently activated modes. Near the bottom of its output you will find this description: Extensions to erlang-mode for communicating with a running Erlang node. These commands generally communicate with an Erlang node. The first time you use one, you will be prompted for the name of the node to use. Here's a subset of the available commands. Use `describe-mode' (C-h m) on any Distel buffer when you want to know what commands are available. C-c C-d n - set the erlang node name C-c C-d g - upload the distel modules to the erlang node M-/ - Complete a module or remote function name. M-. - Jump from a function call to its definition. M-, - Jump back from a function definition (multi-level). C-c C-d : - Evaluate an erlang expression from the minibuffer. C-c C-d f - Refactor expressions in the region as a new function. C-c C-d F - Find a module. C-c C-d i - Toggle debug interpretping of the module. C-c C-d b - Toggle a debugger breakpoint at the current line. C-c C-d p - Profile (with fprof) an expression from the minibuffer. C-c C-d L - Reload an Erlang module. C-c C-d r - Reload all Erlang modules that are out of date. C-c C-d w - Who calls function under point. C-c C-d H - Show the html documentation for a function. C-c C-d Z - Show the signature for a function. To get more information about a particular command, use "C-h k" followed by the command's key sequence. For general information about Emacs' online help, use "C-h ?". If you want to write new commands of your own, the programmer's manual tells you how. You can make a postscript copy with "make postscript", or an Info version with "make info" and "make info_install". For more background about the "Session" commands, have a look in README.ie-session. Hope you enjoy, and please send hacks or feedback to luke@bluetail.com(*)! PS: The "dynamic TAGS" with M-. and M-, is the coolest bit to get started with! Compatibility notes: The profiler front end requires >= R8B (to get fprof) The debugger front end requires >= R8B-1 Distel itself is not formally tested, but it has enough savvy users that it'll typically run on the last 2 versions of Erlang and Emacs (as of 2008 OTP R11/R12 and Emacs 21/22). (*) Luke Gorrie is unfortunately no longer involved with Distel, and Blutail no longer exists... there is of course the distel-hackers mailing list; https://lists.sourceforge.net/lists/listinfo/distel-hackers and the issue tracker at google; http://code.google.com/p/distel FAQ 1. Can't handle event closed in state derl-recv-challenge-ack this is what you get if the erlang node and the distel node disagree one what cookie to use. Use (in erl) erlang:get_cookie() and (in emacs) M-x erl-get-cookie to check the cookies.
1. 下载
https://github.com/massemanet/distel
之前一直node down,是因为我下了老版本。从 http://code.google.com/p/distel/下载的版本有问题。
2. 解压到 ~/.emacs.d/plugins/ 目录下,重命名文件夹为 distel
3. 安装,打开终端,输入
cd ~/.emacs.d/plugins/distel
sudo make && sudo make install
如果最后提示
Successfully installed. See README for usage instructions.
则说明安装成功。
4. 配置 .emacs
添加下面内容到 .emacs中 ;; This is needed for Distel setup (let ((distel-dir "/usr/local/share/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)))))
重启,ok,配置完成。