emacs

Emacs is hurting Clojure 

Emacs is a very powerful text editor and its popularity amongst Clojurians is easily understood. Emacs has a long tradition in the Lisp communities as it’s written, in a big part, in a flavor of Lisp called Emacs Lisp.

Because of its history, it handles Lisp code wonderfully, with automatic correct indentation, paraedit, integration with REPLs, etc. But Emacs is really hard to use.

Yeah, most Clojurians know how to use it by now and they suffer from bias: “it’s not that hard” they say. Learning Emacs or Clojure is hard enough. Combining them is insane.

Many Clojurians also say it’s worth it. And again, I think they are biased. Human brains are very good at forgetting pain. Other editors these days are also very powerful and although not as much as Emacs, their usage is intuitive so you can achieve a higher level of proficiency just by using it, without spending time and effort in becoming better at it.

The way Emacs is hurting Clojure is by Clojurians maintaining this myth that you need to use Emacs for Clojure. This is not done by simple statements but by a general culture of jokes saying things such as “you are wrong if you don’t use emacs”.

Me, personally, I don’t care what editor you use. If you want to learn Emacs, go for it. Intellij and Cursive is much easier to use and almost as powerful. When I compare myself to another clojurian, productivity is generally decided by knowledge of the language and libraries, not the editor. If you want to use another editor, so be it. It’s better if they understand Lisp code but it’s not a deal breaker for learning Clojure.

I do care about the success and popularity of Clojure. Coupling the growth of the language to the use of an editor that is hard to use and non intuitive makes no sense. It’s hurting us. Even if you are an Emacs power user, when you talk to a Clojure newbie, please, don’t push it down their throats.

Thank you.

Getting started with La Clojure on Mac OS X, a visual guide

These are instructions to get started with Clojure using IntelliJ IDEA, La Clojure and Leiningen for people that don’t know any of those tools. They are for Mac OS X but they may be adaptable to other operating systems as well.

It doesn’t expect you to know Clojure or IntelliJ IDEA. I think this might be a good way for beginners to get started (instead of Emacs for example). I been using RubyMine for quite a while and I’m happy with it. The only requirement in installing Homebrew on your mac, which you should anyway if you want to code.

Install Clojure and Leiningen using Homebrew:

brew install clojure
brew install leiningen

Download IntelliJ IDEA and install it:

Run it:

Open the preferences (⌘,) and go to the plugins section:

Download and install La Clojure plugin:

Download and install the Leiningen plugin.

 

Restart IntelliJ IDEA:

 

Create a Leiningen project:

lein new foobar
 Created new project in: /Users/pupeno/Temporary/foobar

Open the project in IntelliJ IDEA:

 

Now open Project Structure (⌘;) and go to SDK. If you tried to run the Clojure REPL and got the error “No jdk for module ‘foobar'”, this is what you need to do to fix it:

Click on the plus sign and add a JSDK:

The default is just fine:

And you should see something like:

Go to the project

and select the newly created 1.6 SDK:

Go to modules

open dependencies:

and add a single entry:

Use the installed Clojure from /usr/local/Cellar/clojure/1.2.1/clojure.jar:

I’m not totally sure about that step. It might be that the IntelliJ project you are creating works only on a machine where Clojure is located on the same path.

As they say… works for me! Restart IntelliJ… not sure if you’ll need to, but I needed it.

Open the project if it wasn’t open and start the Clojure REPL (⇧⌘F10), it’s in the Tools menu:

It works:

Open a file:

Type a little program, like:

(defn hello-world []
  (println "Hello world"))

Load the file on the REPL (⇧⌘L), which is in Tools → Clojure REPL:

Enjoy magnificent code completion:

and run the code:

And that’s it. Whether IntelliJ IDEA and La Clojure is a viable developing environment only time will tell.