« My HTML Mode for Emacs | Main | Audio Podcasts: Competing with Non-consumption »

Emacs and Ruby

Jao at Programming Musings linked my my post on tools with a nice article on using powerful editors.

Jao’s post included a link to a screencast on using emacs and ruby by Marshall Vandegrift. I’ve been using emacs for 20 years, but I learned a lot of useful little tricks. Vandegrift has a post giving links to the various packages he uses in the screencast. Here’s the ones I found interesting.

One of the things I’ve always liked about TextMate is its signature directory listing on the left hand side and the ease with which that allows you to move between files in a file-based programming language like Ruby (or Java, for that matter). I should have known that emacs could do it. The package is the emacs code browser. Note that there are three packages it depends on. Nothing tricky in the installation, but it takes a little time. Once you get it installed, it’s the middle mouse button that selects things in the menu (that, of course, can be changed).

I’ve used ispell for 15 years, but had never heard of flyspell, a package that’s included in emacs and gives you on-the-fly spell checking. Good to know.

Another thing you might find handy (that Vadegrift used in the screencast, but didn’t talk about in the post) was electric mode. There are electric modes for various languages, I hadn’t looked for one for Ruby. Here’s a post from Hyperion Reactor that gives a setup for electric mode for ruby and rails.

Note that I’m not writing all this to convert the dedicated vi users or anyone else. If you’ve got something that works for you, then good enough. But if you’re searching for a editor that’s programmable with plenty of headroom, then give emacs a try. There’s a steep learning curve, but the view is great from the top (or even half way up)!

Posted by windley on October 23, 2006 3:15 PM

See related posts:

2 Comments

Comment from Ben at October 24, 2006 6:28 PM

I currently use emacs for most of my editing and do a lot of Ruby/Rails programming. I will be buying one of the new nifty mac book pro's soon and I will have the option of texmate (I have been on windows/linux)... Being an emacs guy yourself would you reccomend switching over to texmate for ruby? I have been planning on looking into it because it is so popular in the rails community.

I've been programming in Ruby and Rails for a grand total of 3 weeks now, so my experience isn't very deep, but judging from what I've found and linked to above, I think using Emacs is a very viable option.

Make sure you load and understand the rails mode referenced above and make use of the ruby-electric mode. You'll also need a good HTML mode (the XML mode that is referenced above seems good--if I didn't have my own mode I was used to, I'd strongly consider it).

If you're already an Emacs user, I wouldn't give that up.

Leave a comment

I encourage you to leave a comment below. Your email address will not be displayed on Technometria, but allows me to communicate with you directly. Your email address won't be displayed, but will be used to compute a MicroID for your comment.