How to enter Erlang Mode in Emacs

emacs

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?

Best Answer

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

Related Question