Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question

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

share|improve this answer
thanks. how do i find where otp is installed? is there an erl command for it? – B_R Sep 10 '11 at 17:28

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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