如何设置 Erlang + Emacs 与 erlang.el ?
我已经下载并安装了 Erlang 和 EmacsW32。但是如何在 Emacs 中使用 erlang.el
呢?我应该将其放置或安装在哪里?
我已阅读 Erlang/OTP R13B04 文档 和 Emacs 文档的 Erlang 模式 但我还没有找到任何有关如何设置它的信息。
更新1:我在Erlang上找到了更多文档Emacs 模式。我已经在 .emacs
中输入了脚本,但是当我启动 Emacs 时,出现了 File error: Cannot open load file, erlang-start
,所以出现了问题。
更新2:这就是我的.emacs
的样子。它是直接从上面的链接获取的。
(setq load-path (cons "C:/Program Files (x86)/erl5.7.1/lib/tools-2.6.4/emacs"
load-path))
(setq erlang-root-dir "C:/Program Files (x86)/erl5.7.1")
(setq exec-path (cons "C:/Program Files (x86)/erl5.7.1/bin" exec-path))
(require 'erlang-start)
更新3:我现在已经在另一台计算机上尝试过,Windows 7,GNU Emacs 23.1.50.1 .emacs
文件位于 C:\Users\Jonas\.emacs.d\.emacs
,内容如下:
(setq load-path (cons "C:/Program Files (x86)/erl5.7.5/lib/tools-2.6.5.1/emacs"
load-path))
(setq erlang-root-dir "C:/Program Files (x86)/erl5.7.5")
(setq exec-path (cons "C:/Program Files (x86)/erl5.7.5/bin" exec-path))
(require 'erlang-start)
当我尝试输入 Mx erlang-在 Emacs 中,版本
,我收到此消息:[No match]
I have downloaded and installed Erlang and EmacsW32. But how do I use erlang.el
in Emacs? Where do I place it or install it?
I have read Erlang/OTP R13B04 documentation and Erlang mode for Emacs documentation but I haven't found any information about how to set up it.
UPDATE 1: I have found more documentation on The Erlang mode for Emacs. I have typed in the script in my .emacs
, but I get File error: Cannot open load file, erlang-start
when I start Emacs, so something is wrong.
UPDATE 2: This is how my .emacs
look like. It's taken directly from the link above.
(setq load-path (cons "C:/Program Files (x86)/erl5.7.1/lib/tools-2.6.4/emacs"
load-path))
(setq erlang-root-dir "C:/Program Files (x86)/erl5.7.1")
(setq exec-path (cons "C:/Program Files (x86)/erl5.7.1/bin" exec-path))
(require 'erlang-start)
UPDATE 3: I have now tried on another computer, Windows 7, GNU Emacs 23.1.50.1
The .emacs
file is located at C:\Users\Jonas\.emacs.d\.emacs
with this content:
(setq load-path (cons "C:/Program Files (x86)/erl5.7.5/lib/tools-2.6.5.1/emacs"
load-path))
(setq erlang-root-dir "C:/Program Files (x86)/erl5.7.5")
(setq exec-path (cons "C:/Program Files (x86)/erl5.7.5/bin" exec-path))
(require 'erlang-start)
When I try to type M-x erlang-version
in Emacs, I get this message: [No match]
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以查看 我关于 Emacs 和 Emacs 的文章Erlang 了解详细信息。标准方法是将 erlang.el 放在某处,并使用 load 命令显式加载它。
从我的角度来看,最好使用 erlware-mode,因为它包含对标准 erlang-mode 的一些扩展。你可以在这里查看我的erlang配置 。它在 Windows 下工作,但您需要检查哪个值具有环境变量 %HOME% - '~' 符号扩展为它的值。
You could look to my article about Emacs & Erlang for details. Standard way is to put erlang.el somewhere, and load it explicitly with load command.
From my point of view it's better to use erlware-mode, as it contains some extensions over standard erlang-mode. You can see my erlang config here. It works under windows, but you need to check which value have env variable %HOME% - the '~' sign is expanded into it value.
查看
.emacs
是否被使用的一种方法是暂时移动您的版本,进入 Emacs 并更改一些设置(例如默认字体),然后按保存选项 选项菜单。这将为您创建一个.emacs
文件。也许它会在同一个位置,或者 Emacs 可能决定将它放在其他地方。 找出它的位置并在那里添加您的设置。该设置应在重新启动时重新加载。
如果您收到缺少
erlang-skels.el
的错误(因为它实际上在某些 R13B 版本中),我建议安装erlware-mode (在此处下载 zip)。将其放入您的.emacs.d
文件夹中,然后更改您添加的加载路径以指向该目录。这是一种更完整且错误修复的模式,除其他外还具有更好的缩进。您的 erlware-mode 配置应如下所示(如果您将 erlware-mode 文件放入
.emacs.d
中的erlware-mode
文件夹中):One way to see if your
.emacs
is used is to temporarily move your version, go into Emacs and change some setting (default font for example) and then press Save Options in the Options menu. This will create a.emacs
file for you.Maybe it will be in the same location, or Emacs might decide to put it somewhere else. Find out where it is and add your settings there. The setting should be reloaded at restart.
If you get the error that
erlang-skels.el
is missing (as it actually is in some R13B releases), I would suggest installing erlware-mode instead (download zip here). Put it in your.emacs.d
folder and change the load-path addition you made to point into that directory instead. It is a much more complete and bug fixed mode with better indentation among other things.Your config with erlware-mode should look like this (if you put the erlware-mode files inside a
erlware-mode
folder in.emacs.d
):您确定
C:/Program Files (x86)/erl5.7.1/lib/tools-2.6.4/emacs
中有文件erlang-start.el
吗?也许你应该将tools-2.6.4
更改为其他名称,找出你的erlang路径中的名称是什么。Are you sure there is a file
erlang-start.el
inC:/Program Files (x86)/erl5.7.1/lib/tools-2.6.4/emacs
? Maybe you should change thetools-2.6.4
to other name, find out what is the name in your erlang path.