Emacs Setup For Ruby on Rails
This post goes over how I’ve set up emacs for Ruby on Rails development on my development machine (a macbook pro running windows 7 and snow leopard).
Background: I’ve been getting back into Ruby on Rails development this past week and converting from vim to emacs in the process. Nothing against vim, I recently got introduced to emacs while learning lisp and learned that I happen to prefer emacs over vim, so I’m switching to it.
Helpful resources I’ve come across while setting up my environment are:
- The Emacs Lisp Package Archive (ELPA) install documentation (easier than using Stephen’s guide for installing some of the files) http://tromey.com/elpa/install.html
- Stephen O’Donnell’s blog which goes over his emacs setup: http://appsintheopen.com/articles/1-setting-up-emacs-for-rails-development/part/6-setting-up-the-emacs-code-browser Especially useful are his suggestions to set up:
- Emacs Code Browser (ECB) – gives a good file explorer that’s kind of like NerdTree on vim. (Or the file explorer on TextMate according to those who have used it). However, his ECB install instructions are out of date for emacs 23.3. Better instructions for the CEDET configuration aspect of setting up ECB could be found at: http://stackoverflow.com/questions/3134026/emacs-23-2-with-ecb-2-40-file-error-cannot-open-load-file-semantic-ctxt You might also want to enable ecb to activate automatically when emacs starts by including the line: (ecb-activate) in your .emacs file.
- Ruby-Electric – code completion on the level of do – end, matching parentheses, and that sort of thing. Easier to install via ELPA.
- Tab setup – To set tabs to mean two spaces, and to convert all tabs to spaces in case they ever do make their way into a file. http://www.jwz.org/doc/tabs-vs-spaces.html