In January I posted that I was diving into Linux full-time for my Erlang work. Erlang RigErlang itself runs great on Windows, Linux and Mac. I made the shift because most Erlang developers work in Linux and I felt I was probably missing something with my Windows-centric approach. This turned out to be a very valuable exercise. I tried out ErlIDE (Eclipse), a tricked out gedit, Vim, and Emacs. In the end, the best-paved and most productive path for Erlang development appears to be Emacs tricked-out with Erlang goodies and a console standing by for running Rebar and Git commands.

Here’s what my Erlang rig consists of:

  • Emacs 23.3
    • Erlang mode : Provides syntax highlighting,
    • Flymake: shows warnings and errors on the fly as you type like visual studio
    • IDO: Adds a good way to browse directories and open files
    • color-theme: adds pretty colors and fonts
    • Distel: theoretically provides auto-completion, step through debugging and other goodies.
    • Key mappings: Adds the key bindings for Cut,Copy,Paste,Alt-F4, Ctrl-Tab that a red-blooded Windows expects.
  • Rebar
  • Git

A few months in, I realized all of these things should work just fine on Windows. Today I have the same Erlang development rig on both Windows and Linux. This makes me very happy. Why? I’ve mentioned this in previous posts, but I believe C# and Erlang are great complements. Even in a Windows-only .NET shop with no appetite for introducing Linux, there’s no reason to take Erlang off the table. Having a proper Windows tool-chain for Erlang development moves the discussion away from an OS holy war and back to a cost-benefit analysis of Erlang itself. That’s a good place to be.

Each time I’ve done my “Intro to Erlang for C# Developers” talk, folks see my Windows Emacs rig in action and ask “What’s involved in getting that to work?” For anyone who is interested here are the steps:

Get Erlang R14B03

  1. Download Erlang from here.
  2. Run the otp_win32_R14B03.exe setup file. By default the installer wants to put Erlang here “C:\Program Files\erl5.8.4″ but change that to “C:\erlang\erl5.8.4\”. OK, but why? Most of the tools and scripts you will use for Erlang development on Windows were crafted over on Linux and the authors may not have tested for spaces in the path (e.g. “Program Files”). Remove that risk.
  3. Add “C:\erlang\erl5.8.4\bin” to your PATH.

Get Emacs 23.3

  1. Download Emacs 23.3 from here.
  2. Right click the zip and “Unblock” it.
  3. Extract it to a sensible location such as “C:\utility\emacs-23.3″. Again avoid spaces in the path to avoid unnecessary pain.
  4. Add “C:\utility\emacs-23.3\bin” to your PATH.
  5. Add an environment variable named “HOME” and give it the value of your home directory (for me this is “C:\Users\bryanhunter”)
  6. Run Emacs. When it loads it should have a white background, a homely font, and the most hideous splash screen you’ve ever seen.
  7. Close Emacs.

Pull down my Emacs configuration files [updated 8/27/2011]

  1. Visit my GitHub repository named ErlangRigEmacsConfig
  2. Read the readme file
  3. Download the zip of the repository. This repository contains the “.el” (Emacs Lisp) files that turn plain old Emacs into something pretty nice for Erlang development.
  4. Right click the zip and unblock it
  5. Extract it into your home directory (for me this is “C:\Users\bryanhunter”). Note: this needs to match what you put in the HOME environment variable under the Emacs steps.
  6. Edit your “~/.emacs” file to something like this:

If all went well, when you open Emacs it will show a nice black background screen. If you (or I) missed something, you will see the hideous default Emacs splash screen.

Extra credit #1: Use a prettier font

  1. Download the lovely “DejaVu” font family from here.
  2. Unblock the zip and extract it somewhere.
  3. Open up the “dejavu-fonts-ttf-2.33\ttf\” directory.
  4. Select all the TTF files and drag them into your “C:\Windows\Fonts” directory.
  5. Open the “my-config.el” file (it’s in your fancy new Emacs configuration directory).
  6. Find the line that reads “:family “Consolas”" and replace “Consolas” with “DejaVu Sans”.
Extra credit #2: Start learning Emacs Lisp
  1. Open the “my-config.el” file (it’s in your shiny new Emacs configuration directory).
  2. Read it top-to-bottom.
  3. Tinker, save your changes, reload Emacs.
  4. Read the “Programming in Emacs Lisp” guide  (here) to get smarter.
  5. GOTO 3

[Note: this post will be in flux until it is correct and complete. Please comment to help me get it there.]