Poking at Erlang

Sat Jan 23, 2010

It's been a while since I touched it, so I figured I'd download the Erlang reference and language implementation and play around with it. This is also the first time I've played with it while being an admitted Emacs user though1.

Sounds like a good time to get Erlang mode running inside Emacs rather than having to muck around with erl in the terminal. A search for "erlang mode emacs" links me to the Erlang/OTP site where I found the documentation earlier. Turns out that Erlang comes with its own Emacs mode. I guess the guys and gals over at Ericsson labs are all Emacs hackers too2.

Anyway, it turns out that all you really need to do is install Erlang, then add /usr/lib/erlang/lib/tools-[version number]/emacs to your load path, and

(setq erlang-root-dir "/usr/lib/erlang")
(setq exec-path (cons "/usr/lib/erlang/bin" exec-path))
(require 'erlang-start)

elsewhere in your .emacs file. Note that you'll need to change those directories based on where you installed Erlang. The above are what I had to do after running apt-get install erlang. If you did yours manually, it'll be different.

Once that's done, M-x erlang-mode gets you the right mode, and M-x erlang-shell gets the current buffer running erl.

  1. As an aside, I also found one post from a user who highly recommended the Erlang emacs mode, even to users of other editors. His advice ran something like "What you'll want to do is type $> vim ~/.emacs and edit that file to include your Erlang path". I found it chuckle-worthy, at least.

Creative Commons License

all articles at langnostic are licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License

Reprint, rehost and distribute freely (even for profit), but attribute the work and allow your readers the same freedoms. Here's a license widget you can use.

The menu background image is Jewel Wash, taken from Dan Zen's flickr stream and released under a CC-BY license