Ruby on Emacs(journey from TextMate to Emacs…)
Im a GNU/linux fan to the core, so sooner or later this was gonna happen. Ever since i started using TextMate, the fact that it was a non-free ware and i couldn’t hack it kept me uncomfortable. Besides that, it is not available for all operating systems(those who have used TextMate know its available only for MacOS). I don’t feel too excited about my OS X Leopard anymore and im planning to move back to Ubuntu/Debian…. (i have a bunch of reasons, but i will keep those for another post), however, a ruby developer using TextMate would find it difficult to live with a not-so-good editor(especially so, when moving to other operating systems). Now here is the good news…. with sensible tweaking, Emacs is capable of outshining anything else(yes… and that anything else includes TextMate). Infact nothing comes close to a well tuned Emacs.
I spent last few days setting Emacs up to my taste… and having used it for a few days now, i got so addicted to it, that i have deleted TextMate altogether from my Mac. Being an ex-TextMate-user, i think a lot of other TextMate guys willing to try Emacs may find this post useful… So here is what my setup looks like….
Emacs(mac version): The editor itself. Mac users have a few options here, i used Carbon Emacs(personal preference).
ECB(Emacs Code Browser): This is a brilliant replacement for TextMate sidebar(the little window on one of the sides that acts as a handy file browser) in Emacs. It actually is more than a replacement. It gives you a few other great things like method browser and stuff. I use version 2.32. Install cedet before you install ECB(ECB needs cedet).
Ruby Mode: This defines Ruby mode(major mode) and has Ruby electric(minor mode) etc….. (i keep pabbrev disabled, once again… personal preference)
Rinari: This is the ruby on rails addon which i really love. This has a few shortcuts that are very useful for people doing RoR webapps.
test-runner: This is a killer even though it doesn’t look like one. I find it really useful. It runs your tests in place and has a few sensible defaults like running test every time you save the test/spec file.
tempo-snippets: This is another killer. This one lets you define snippets(some developers call this feature live-templates). IDEs like IntelliJ Idea let you define templates which can be used for generating well structured but repetitive code. This is emacs’ way of doing it. This one is another brilliant add-on.
window-numbering-mode: If you are planning to use emacs with ecb… don’t miss this one. Window numbering allocates numbers to every window in the frame, and allows you to navigate seamlessly with M-<x>(x is the window number).
ido: This is really a ‘must have’ add-on. It makes switching buffers/finding files/commands….. a breeze. ido absolutely rocks(even if you are an iswitch guy, you definitely want to give this a shot)!!!
This is pretty much it(for ruby developers atleast….). I have a few more add-ons, but those are unrelated to ruby.
To make life easy for people starting out with emacs, i have posted my tweeks here. At times i acted impatient and hacked some files in-place(inside packages that i have installed), and unfortunately i can’t post those hacks on the web because i don’t remember the exact file and line, but im sure anyone with some understanding of elisp can to do those little tweaks without too much trouble.
Why should anyone move to Emacs….???
Well, emacs is available for all Operating Systems(so the day you feel you had enough of Mac, you don’t have to think twice before switching to GNU/Linux). It has been there since dark ages of computer science, which means more hackers have used it, contributed to it, and there are more extensions written for it(so if you want that nifty cool feature, there is a good chance someone has already implemented it for you). Most of it is plain elisp code, which makes it easily extendable/modifiable(when you don’t like something, you don’t have to live with it and when you want something which no one else has done before, elisp makes implementing it a breeze). It is much more powerful and mature compared to anything else, decades of usability analysis and improvement has made it awesome. And the most important thing is it is Free Software(GNU ware), which means you have the source + permission to modify and re-package and use it your way.
I think sooner or later every developer using mac/windows will realize the fact that GNU/Linux is a lot more evolved and mature environment and when that day comes, you don’t want an editor to come in your way.
I hope this will help someone…. Happy Hacking…..🙂