Playing with Emacs

January 2, 2013 at 11:54 pm
filed under Coding
Tagged , ,

I’m a dyed in the wool Vim user, and I’ve never had time for Emacs. But lately I’ve been playing with it, giving it another chance. Here’s why.

Programmability. I believe in programmable tools because I believe in mastering and customizing frequently used tools. The shell allows you to program your working environment via scripts, functions, aliases, et al. I think an editor should be similarly programmable. As such it’s always bothered me that Vim’s scripting capabilities are as obtuse as they are. Emacs is quite programmable, but more to the point, it’s Lisp.

Clojure. On account of Emacs being, among other things, a Lisp IDE, there are a bunch of well-honed and time-tested tools for editing Lisp. Rainbow delimiters (examples here and here). Paredit is a set of functions designed for manipulating s-expressions. There are a bunch of interactive modes, as well, which facilitate the interactive style of development common to Lisps. Clojure can take advantage of many if not all of these.

Experimentation. Vim takes a modal approach to editing, and commands are combinations of keystrokes. The Emacs paradigm is completely different, as far as I can tell. Nearly every piece of functionality is a function. This has implications for programmability, yes, but it’s also an entirely different way of thinking about your editor.

Initial impressions

So far, it’s clear that Emacs is a completely different beast. I’ve set up package.el where appropriate (Aquamacs for Mac, emacs24 for Linux) and installed a bunch of packages that way.

Keycuts are mostly unknowable to me, and I don’t think I’ll ever master them. Some of them are ridiculously complex. This is the down side of not having a modal interface: modality comes through keycuts, or perhaps more like keychords, frankly. It wasn’t long before I installed evil, a vi emulation mode, for the motions and window/buffer management pieces alone.

Configuring stuff like fonts and whatnot seems complex to me; Emacs has its own model for the appearance of text (“faces”). Actually, in general, Emacs has its own model and paradigm for various pieces. That’s not a value judgment, as that’s true of Vim in other areas, as well. But it is a substantial adjustment.

I haven’t figured out a good project-style mode akin to Sublime Text’s that doesn’t require a bunch of setup beyond picking a few directories. Vim falls down here, too, for what it’s worth.

I will say that configuring it, as expected, is a lot easier. And it’s almost fun.

Long-term, I don’t know how much I’ll stick with it for anything other than Clojure development. But it’s fun to explore another paradigm and as I become more fluent with it I’ll get to see the real differences.

  • So how is it going? I share your background and opinions, I left emacs alone mostly because those damn shortcuts and my pinky hurting a bit. I mean mainly the mode shortcuts, the editing ones are actually nice and useful around the terminal and a few other places.

    Is it worth it? At least for clojure dev?

    I’m liking your posts, will keep exploring :), maybe I will find out what happened with clojure vs haskell.

  • Matthew

    @Joaquin: I think it’s worth it for Clojure dev. There are some rough spots, for sure. But I would say that one area where Lisps tend to shine is when you can develop pieces incrementally, composing small, specialized functions into pipelines. Clojure is no exception. Being able to re-eval your source in the repl and paste from the repl to your source so easily is an asset. I say this as someone who declined to switch to Emacs full-time (Sublime Text w/ Vintage is my primary editor).

    As for your sore pinky, have you considered remapping Caps Lock to Ctrl? I do this on Mac and Linux and significantly eased the wear and tear on my wrists & pinky. I haven’t been able to do much about Alt/Meta though.

  • Is continued playing and foud my salvation in evil mode. It is surprisingly well done and works wonders. I’ve started finding plugins that fill my needs an right now I’m reading the programming in emacs lisp book, which is well written and it’s making me understand a lot more what’s going on. Also remapping caps lock is a must!
    Thanks for the response

%d bloggers like this: