A Month with Emacs

I code for a living – well, sometimes I help other people code, but I spend a pretty fair amount of time touching code myself. That’s the way I like it, and I hope to do it for a long time to come.

Given that I’ve been doing it for a long while already, finding ways to do it well that are sustainable makes sense to me.

As a result, I’ve re-acquainted myself with Emacs, in a big way. As I went, I developed a video series to document using Emacs for Scala development.

Someone once described building your emacs config (feels inadequate to call a few thousand lines of Lisp a “config”, but still) as the equivalent of a Jedi building his own light-sabre. Only after you’ve done it are you a true Emacs user.

Well, I’ve got my light-sabre pretty much where I want it, and I’ve been doing all my Scala development for at least the last month exclusively in Emacs. There are still plenty of tweaks I’d like to make, but they’re small fry compared to what I’ve got working already.

I thought I’d report on progress, in case it’s useful for other people planning the adventure.

Another 9 years, 11 months…

First off, I’m hardly “done” learning Emacs, whatever that means. I’ve known the basics of Emacs for many years, having used it off and on for decades, along with many other editors, even VI. Yes, I’m bi-editorial, or whatever the correct term is: I can use (and appreciate) both VI and Emacs. (This may get me burned at the stake by both religions, I’m not sure).

In any case, Emacs is not my first rodeo, not by a long shot. I’ve used IntelliJ, Eclipse, IBM’s VisualWorks, JEdit, Sublime Text, TextMate, and dozens more. Hell, I’ve even used “ed”, in case anyone’s left that knows what that is besides me icon smile A Month with Emacs

Ergonmics

After trying just about every kind of keyboard there is, I settled some time ago on an IBM Model M. When I can’t get a new one, I use the Unicomp version. If I must, I use a trackball, or an Apple magic trackpad. I do have a couple of mice as well, but find when I need a mouse I actually need a trackpad.

Emacs, plus a few tricks like Spectacle and Quicksilver, allow me to hardly ever touch that trackpad/trackball, and this is my win ergonomics-wise. It’s quite a bit, it turns out. Emacs, quite famously, uses a number of combination keys (it’s sometimes called Escape Meta Alt Control Shift, in fact), but these can be remapped however you want, and it’s still far better than taking your hands off the home row.

For my home-office setup, I actually have a few more gadgets to make things even more efficient, but that’s another later post.

Speed

While I’m still learning, I can now safely say that I can edit faster with Emacs that I can with VI. That’s pretty fast, as VI is no slacker. There’s still a few keybindings I’d like to tweak, sometimes I miss things like “change word” (yes, I know there’s a way to do that in Emacs). It’s like typing Dvorak – at first you’re stumbling around mostly breaking stuff, then it’s not bad, then it’s better…

I’m at the point now where every now and then I get into the flow pretty well, and I stop thinking about the editor entirely, and I’m just thinking code. For those brief moments, which are slowly getting longer, I’m smoking along pretty good, cranking out and working on Scala code far faster than I can do it in IntelliJ, which is also pretty fast. I’m also writing a book in Emacs – which means I’m using the same editor to write a book as to write my code, another big plus.

More than just fast, I find Emacs efficient. That is, you don’t do a lot of messing with the editor to get work done – it doesn’t get in the way, or change the way you want to work. I can have an editor up and running, showing me the code in a project, in about two seconds on a feeble laptop. I can use the same editor for any language I choose, and for any kind of file I want to edit, even over an SSH link to a remote box. I can (and have) use an iPad with a bluetooth keyboard with a remote AWS instance as a development box, all with the same editor.

What do I miss?

I miss the clever feature in IntelliJ that will highlight unused imports. I miss code completion of the .apply method on case classes. I miss the ability to browse external dependencies easily. That’s about it. I can fix all of these, in time.

I don’t miss the crashes, I don’t miss when the IDE craps out and disappears, I don’t miss the slowdowns and painful delays starting up. I don’t miss upgrading the plugins every seven minutes, I don’t miss the random bugs, I don’t miss my IDE scrambling my refactors to the point where I revert from source control on a regular basis.

GUI-based IDEs can be prettier, but I’m not coding for pretty, I’m coding to get work done, and Emacs is substantially easier to read the code, find the code, edit the code — and that’s the job I want my editor to do.

Multi-Lingual

Of course, I don’t only do Scala, I actually work in a number of languages from time to time, although Scala is my go-to stack. Emacs comes with me: everything works if I’m cranking out Haskell, Clojure, whatever. That’s pretty nice, even though it doesn’t directly help me with my Scala development. Of course, even writing Scala I still have to write Javascript (or Coffeescript), HTML, Markdown… so in that sense, it’s great to do all of these in the same powerful editor.

Conclusion

I’m sold. I won’t be removing all other IDEs, as once in a while they do something extra I really want, and it’s important to keep your familiarity with other IDEs, as your teammates might be using them, and you don’t want them to be forced to use something they don’t know.

But my go-to editing suite is now my custom Emacs setup.

What’s your IDE/Editor of choice? Take Our Survey and let us know!

Principles and Practices

Tired of the Software Development Grind? Know it can be done better? Check out my book (almost finished!): Principles and Practices of Software Craftsmanship or sign up for my Craftsmanship Dispatches newsletter.

Published: August 11 2013

  • tags: