简体   繁体   English

如何使用erlang.el设置Erlang + Emacs?

[英]How to set up Erlang + Emacs with erlang.el?

I have downloaded and installed Erlang and EmacsW32 . 我已经下载并安装了Erlang和EmacsW32 But how do I use erlang.el in Emacs? 但是如何在Emacs中使用erlang.el 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. 我已经阅读了Elang文档的Erlang / OTP R13B04文档Erlang模式,但我没有找到有关如何设置它的任何信息。

UPDATE 1: I have found more documentation on The Erlang mode for Emacs . 更新1:我在Emacs的Erlang模式上找到了更多文档。 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. 我在我的.emacs输入了脚本,但是我得到了File error: Cannot open load file, erlang-start当我启动Emacs时File error: Cannot open load file, erlang-start ,所以出了点问题。

UPDATE 2: This is how my .emacs look like. 更新2:这就是我的.emacs样子。 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: 更新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)

When I try to type Mx erlang-version in Emacs, I get this message: [No match] 当我尝试在Emacs中键入Mx erlang-version时,我收到此消息: [No match]

You could look to my article about Emacs & Erlang for details. 您可以查看我关于Emacs和Erlang的文章了解详细信息。 Standard way is to put erlang.el somewhere, and load it explicitly with load command. 标准方法是将erlang.el放在某处,并使用load命令显式加载它。 From my point of view it's better to use erlware-mode, as it contains some extensions over standard erlang-mode. 从我的观点来看,最好使用erlware-mode,因为它包含一些超过标准erlang-mode的扩展。 You can see my erlang config here . 你可以在这里看到我的erlang配置。 It works under windows, but you need to check which value have env variable %HOME% - the '~' sign is expanded into it value. 它在windows下工作,但你需要检查哪个值有env变量%HOME% - '〜'符号被扩展为它的值。

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. 查看是否使用.emacs一种方法是暂时移动版本,进入Emacs并更改某些设置(例如默认字体),然后按“ 选项”菜单中的“ 保存选项 ”。 This will create a .emacs file for you. 这将为您创建一个.emacs文件。

Maybe it will be in the same location, or Emacs might decide to put it somewhere else. 也许它会在同一个位置,或者Emacs可能决定将它放在其他地方。 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 ). 如果你得到erlang-skels.el缺失的错误(实际上是在某些R13B版本中),我建议安装erlware-mode在这里下载zip )。 Put it in your .emacs.d folder and change the load-path addition you made to point into that directory instead. 将它放在.emacs.d文件夹中,然后将您所做的加载路径添加更改为指向该目录。 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 ): 您与erlware模式的配置应该是这样的(如果你把erlware模式文件内erlware-mode文件夹.emacs.d ):

(setq load-path (cons "C:/Users/Jonas/.emacs.d/.emacs/erlware-mode" 
 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)

Are you sure there is a file erlang-start.el in C:/Program Files (x86)/erl5.7.1/lib/tools-2.6.4/emacs ? 你确定在C:/Program Files (x86)/erl5.7.1/lib/tools-2.6.4/emacs有一个文件erlang-start.el吗? Maybe you should change the tools-2.6.4 to other name, find out what is the name in your erlang path. 也许您应该将tools-2.6.4更改为其他名称,找出erlang路径中的名称。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM