I’d like to share with the community my emacs init file and a set of plugins to give a nicer experience on Ruby on Rails development, which you can checkout from http://github.com/spastorino/my_emacs_for_rails/tree/master. I have been using this environment under emacs 23, and it has not been tested on other emacs versions, so all feedback is welcome, if something goes wrong please feel free to contact me.
What’s in the package?
The package provides my customized Emacs init file and some plugins I found very useful to enhance Ruby on Rails development experience.
Plugins
- anything
- auto-complete
- autotest
- cedet
- color-theme
- ecb
- find-recursive
- flymake
- javascript
- nxhtml
- rcodetools
- rdebug
- redo
- ri-emacs
- rinari
- ruby-block
- ruby-mode
- toggle
- yaml-mode
- yasnippet
- yasnippets-rails
Installation
Before you can use some plugins you have to install a few packages:
To use rcodetools you need to install the rcodetools, gem withsudo gem install rcodetools
To use autotest you need the ZenTest gem, install it with
sudo gem install ZenTest
On further post I’m going to explain how to set it up under the gnome environment using all the beauty that gnome-notifier has.
Checkout the package
git clone github.com/spastorino/my_emacs_for_rails
and copy all the files under my_emacs_for_rails directory to ~/.emacs.d directory if it doesn’t exist you have to create it.
Screenshot
You can see here some screenshots to get a taste of the look and feel that this one has.




Very nice ! The first emacs configuration that runs smoothly with rails.
Very cool, it’s nice to see people in the rails community sharing their emacs configuration. I can’t figure out wether or not I like the ECB or not. It’s handy, but a little slow.
Have a look at my emacs for rails dev config: http://github.com/mig/emacs-rails-kit
Thanks
Nice article, thanks for sharing.
Have you been able to get rdebug to work with rails? Have you been able to integrate it with emacs’ gud (grand unified debugger)? Thanks.
Peter, you can integrate it with rdebug. All you have to do is M-x rdebug and perhaps you want to run with rdebug—emacs 3—no-stop PATH_TO/script/server And of course manage your breakpoints as usually.
Very nice indeed. I’ve been hoping to turn emacs into a decent RoR IDE for some time. Thanks for sharing.
How do you get code completion the way you show in the screenshot? Is there some key to press or something? I’ve installed the packages, and I think it’s working (I get highlighting, file and method browsers etc) but I don’t seem to get code completion
The autocomplete shown in the screenshot is done automatically while you type, basically by searching for existing snippets and words previously written in the file. There are more advanced ways to autocomplete. I’ve put together some shortcuts that are executed by pressing ctrl+meta+i and ctrl+meta+o, but they are not inline and not too confortable. It would be great to have an autocomplete this way but inline, i invite you to give it a shot and send a patch :). I recommend you to pull my latest changes, probably it will work.
Thanks for putting this together. Greatly appreciated. I actually just made the switch from textmate to emacs. I was scouring the internet looking for some resources and I found this.
Epic.
Thanks for this beautiful compilation. Is there something wrong with flymake? I keep getting configuration errors from it. I tried changing the temporary-file-directory variable but the error persists and flymake gets turned off.
Bill, there’s nothing wrong with flymake on my end, but for javascript flymake use rhino which requires Java, perhaps you’re getting error with that?
hi. I’m having trouble finding what is ruby-block for
ruby-block tells you when you step on an end which is the corresponding beginning
Did exaclty as you said. Running Emacs 23.2 (9.0).
Get this when starting Emacs: Warning (initialization): An error occurred while loading `/Users/sondre/.emacs.d/init.el’:
File error: Cannot open load file, textmate
Can you help me?
We need some more information to help you. Probably i should give up with the maintainance of my_emacs_for_rails because lack of time. But definitely i will search for somebody to continue and give somebody commit access to keep up the work.
Hey great article, thanks for sharing. Maybe look deeper at the generation of the form and what is being passed into it?
Hi…I’m newbie with emacs (before I used netbeans) and I don’t know how run it…I installed emacs, download your pack and put it inside /.emacs.d…what need I do now?...thanks…
hi, I tried to use this and it’s very usefull. The only problem is Rspec files. I am writing an Rspec file and it does not put the end for me automatically. I also doesn’t let me tab to indent the next line. Any ideas how to fix it?
Very Use full post, thanks a lot
I got a lot of errors from downloaded plugins/yasnippet This folder has a lot of issues when unzipping. I have reported the issues at your github account.
The git clone url should be git://github.com/spastorino/my_emacs_for_rails.git and not what is mentioned in the blog.
Thanks! I’ve been struggling all week to get emacs to indent html.erb files. I created a new account on workingwithrails just to recommend you.
Where can i get a list of all the key bindings ?