Monday, August 22, 2011

Something new to learn...emacs

I've mostly just been using jEdit as my REPL of choice for clojure, with Eclipse's counterclockwise plugin to actually edit clojure files.  However, I don't like how ccw doesn't let me fire up a standalone REPL, and I didn't like how jedit's clojure repl didn't have a paredit feature.  I also don't like the enclojure plugin for Netbeans which forces you to use Maven style projects for clojure (why do that when there's the excellent leiningen?).  Since Clojurebox is no longer maintained, I figured I may as well FINALLY learn emacs.  I used to joke that you can't really call yourself a linux hacker unless you know either vim or emacs really well.

There are several advantages to using emacs.  Firstly, it seems like most clojurians tend to use it because of the lisp heritage of emacs.  Using swank-clojure and clojure-mode, I can edit clojure files and have a repl too straight from leiningen.  Also, emacs with swank-cdt appears to be one of the only ways of debugging clojure code (allowing you to set breakpoints and such).

On the downside, emacs is....painful.  It is more than an editor, it is basically it's own little ecosystem.  I tried learning vim before, but the whole 'command-mode' vs. 'edit-mode' screwed me up.  I am hoping that emacs 'buffers' don't do the same to me.  Then there's also the complexities of SLIME itself.

As it turns out, getting emacs up and running for Windows was a teensy bit trickier than I had hoped for.  Although the description for getting emacs up and running at the official clojure dev site was helpful, it was also geared towards *nix users.  For example, it tells you to create if necessary, an ~/.emacs.d folder.  So I assumed that in Windows, the ~ (the linux HOME directory) would be the Windows equivalent of C:\Users\<userdir>.  That's not the case.  It's actually C:\Users\<userdir>\AppData\roaming.

But other than that little trick, things turned out fairly well.  So I am now on my way to understanding the lovely world of working with and in emacs :)


UPDATE:
So far, emacs doesn't seem nearly as bad as it was when I tried to learn VIM.  I do need to get Marmalade set up, though that requires an .emacs file which might interfere with the Starter Kit settings.  Nevertheless, emacs is pretty cool.  I like the regex search feature and being able to forward word by word instead of just by beginning or end of line (like with the home or end keys).  The clojure mode syntax highlighting is nice, though I still need to figure out how to use swank-clojure inside of emacs.

Also, it appears that along with swank-cdt, there is also a project called ritz (forked from swank-clojure) which allows for setting breakpoints in clojure code.

No comments:

Post a Comment