Lately, I’ve started digging more and more into Rails, preparing for the start of a Rails powered project. Although there are some IDEs offering decent Rails support(namely NetBeans, Komodo and Aptana Studio) I have always preferred the comfort of Emacs for various reasons. So naturally I embarked on a quest to setup a suitable environment for Rails development in Emacs. After a couple of days of searching and evaluating possible solutions I finally set up a wordy environment. It consists of a couple of components – ruby-mode, ruby-electric, nxhtml-mode and rinari.
As you probably have guessed by now ruby-mode provides support for editing ruby source files. The mode is pretty feature complete and under active development, headed by none other than Matz himself. You can get it from the ruby svn repository. ruby-electric provides auto insertion of closing braces, quotes, ends, etc. It can also the found in the ruby repo. Instructions how to setup both modes can be found here. Although many people recommend adding pabbrev(a mode which provides auto-completion) to the setup, I don’t recommend it – I find the mode mostly annoying and stick to the old school dumb auto-completion with M-/ .
nxhtml-mode is a pretty comprehensive package for web development in general. We need it for its excellent support for erubis templates(.rhtml, .erb.html) and of course xhtml and css.
rinari is a mode for Rails development – it contains rich functionality such as the ability to easily navigate between models, views and controllers in a Rails application amongst other features. Instructions how to set up rinari together with nxhtml-mode can be found on rinari’s home page.
It’s always a good idea to add ecb(the Emacs code browser) to the mix, though this is entirely optional.
I hope you enjoy this setup and it helps boost your Rails productivity in Emacs!
July 28, 2008 at 12:04 pm |
You should try emacs-rails http://dima-exe.ru/rails-on-emacs
July 28, 2008 at 12:29 pm |
Well, I’m aware of emacs-rails, but I prefer rinari. It offers the features that I need packaged in smaller form, and leaves me with the option to add other features if I happen to require them. I track rinari’s dev tree and see that the maintainer is doing a pretty good job of adding valuable features as well as squashing existing bugs.
July 30, 2008 at 10:44 pm |
Do you practice TDD? There are a couple of nice rspec minor-modes for emacs: http://github.com/pat-maddox/myconfig/tree/master/dot.emacs.d/rspec-mode.el (I haven’t used this one yet, but Pat is on the RSpec team)
http://pezra.barelyenough.org/blog/projects/rspec-mode/ (what I currently use along with a couple of macros to customize it to how I work)
I’m currently using emacs-rails, but I don’t use the railsy features much (like navigation between controllers, models, etc.). Maybe I should, but I just use a shell to get around, mostly. It might be time to re-evaluate rinari.
July 30, 2008 at 10:55 pm |
Yes, I do practice TDD. I’ll take a look at those modes when I have some time. The navigation features are very valuable in my opinion, they save quite some time at one point… rinari’s development is moving at a pretty nice pace these days – I think that re-evaluating it will certainly be worth your while.
July 17, 2009 at 11:44 pm |
[...] code I borrowed from elsewhere to further customize my environment. I should particularly mention Devcraft’s advises to customize Emacs for Rails development, Dahoiv’s .emacs file, the Emacs blog (where Ryan McGeary also writes) and the emacs-flu [...]