4

How do I enter erlang mode in emacs to get syntax highlighting? Whenever I open an erlang file nothing special happens. Do I need to change something in my .emacs file, or do I need to add a module to emacs, or something else?

7

Emacs doesn't come with an Erlang mode, so you need to add one. Erlang itself appears to ship with an Emacs mode that you can use; there are instructions on installing it and using it on their website, but it comes down to just adding their folders to your load path and exec path, setting a variable, and requiring the module:

(setq load-path (cons  "/usr/local/otp/lib/tools-<ToolsVer>/emacs" load-path))
(setq erlang-root-dir "/usr/local/otp")
(setq exec-path (cons "/usr/local/otp/bin" exec-path))
(require 'erlang-start)

The paths might be different depending on where you installed Erlang

  • thanks. how do i find where otp is installed? is there an erl command for it? – B_R Sep 10 '11 at 17:28
1

As of 22 March 2013, the Erlang mode is installable through the MELPA package archive. If you haven't done so already, activate MELPA by putting the following in your .emacs:

(add-to-list 'package-archives
  '("melpa" . "http://melpa.milkbox.net/packages/") t)

Then hit M-x list-packages and install the erlang package.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.