My Clojure Editor


Update: Since writing the below I’ve checked out Emacs and through its paredit plus a few more additions and the fact that whatever is missing after that could probably be very easily added will make it my future editor of choice when I get the time to learn how to use that thing.

So I tried both Enclojure and Counter Clockwise. Maybe it’s just me but I couldn’t handle the way they work with regards to the text slinging. I mean they’re great when it comes to browsing files, namespaces and what not but when it comes to a LISP editor you really need some nice features for handling all those parenthesises. I haven’t checked out the Vim / Emacs alternatives since I don’t care for these two editors (maybe the mistake of my life, who knows), they might be awesome and I might realize that some day but not today.

I couldn’t find many of the features I’ve grown accustomed to by using my own Pico Editor, PE. So named because I’ve mostly been coding PicoLisp in it so far (how to here).

Maybe the turn on button for these features is hidden somewhere in the GUI of Enclojure and Counter Clockwise, or maybe it doesn’t exist. I didn’t care to look for long for something that might not be there anyway, so I simply added a Clojure section to my Pico Editor config.

I’ll illustrate a few of the things I just have to have in a Lisp editor that PE has, I’ll use | as a standin for a cursor.


|(some expression) and writing ( will now result in |((some expression)).

|(some expression) and doing CTRL+M will select the expression for easy deletion/cut pasting.

|(func (some expression)) and doing CTRL+R will remove the outer expression resulting in (some expression).

“a string” and selecting it and doing CTRL+W will wrap it with (“a string”) as the result.

(def table 
       (-> (mk-client "localhost" 9160)
                    (key-space "Keyspace1")
              (column-family "Standard1")))

selecting the whole expression and hitting TAB will result in:

(def table 
   (-> (mk-client "localhost" 9160)
      (key-space "Keyspace1")
      (column-family "Standard1")))

Which is properly indented LISP.

In addition to this the editor has code jumping (buggy), namespace/class browser and code completion (and some more stuff you have to discover yourself).

Naturally this thing doesn’t have any fancy repl stuff, they way I code Clojure is I create a temp file that I work with in PE in the root of my project that I run in the repl by repeating (load-file “tmp.clj”)

I’ve put the whole thing up on bitbucket where you also have install instructions etc, enjoy!

Related Posts

Tags: , , , ,