markliang
markliang

Reputation: 41

How to configure erlang mode in emacs?

OK, I create a .emacs file in the path where I install erlang.

 (setq load-path (cons  "/usr/lib64/erlang/lib/tools-2.7.1/emacs"
      load-path))
      (setq erlang-root-dir "/usr/lib64/erlang")
      (setq exec-path (cons "/usr/lib64/erlang/bin" exec-path))
      (require 'erlang-start)
/usr/lib64 is the folder where I installed erlang. But it doesn't work. On the other hand I use this command:

yum install emacs-erlang. 

Then /usr/share/emacs/site-emacs/sit-start.d will have a file named erlang-init.el. And the content in this file is:

(setq load-path (cons "/usr/share/emacs/site-lisp/erlang" load-path))
(setq erlang-root-dir "/usr/lib/erlang")
(setq exec-path (cons "/usr/lib/erlang/bin" exec-path))
(require 'erlang-start)

By this way, emacs can work in erlang-mode. I feel it is strange, because I feel the erlang-init.el is wrong but the .emacs is right. But why in fact .emacs can't work rightly? My OS is fedora 21 and emacs version is 24.4

Upvotes: 0

Views: 702

Answers (1)

phils
phils

Reputation: 73345

OK, I create a .emacs file in the path where I install erlang.

That's not going to do anything unless that path happens to be your $HOME directory.

Emacs loads ~/.emacs -- not any file by that name in any arbitrary directory you happen to put it in. (How would Emacs know it was there?!)

The package-managed file is no doubt being loaded because your system's emacs package has configured a site-start.el file which loads libraries in /usr/share/emacs/site-emacs/sit-start.d/

See: C-hig (emacs) Init File RET

Upvotes: 1

Related Questions