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 documentatio开发者_StackOverflow中文版n 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]
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.
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
):
(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
? Maybe you should change the tools-2.6.4
to other name, find out what is the name in your erlang path.
精彩评论