tags:

views:

204

answers:

5

Name the ways you know to start the Clojure REPL. What is your favourite ? Does it highlight things for you ?

I know of : 1. NetBeans IDE with the Enclojure plugin, and 2. the Leiningen shell script : lein repl

No favorite for me so far, and I'd certainly like some colors.

What else ?

+6  A: 

Syntax-highlighted Clojure REPL is entirely possible in Emacs -- I wrote the necessary code in response to a very old question here on SO: Is there a colored REPL for Clojure? I have since tweaked it to handle the prompt and printouts from the Clojure process properly; the updated version is available in this Gist. Note that it's meant to augment the SLIME REPL and that the most recent version relies on a reasonably fresh clojure-mode. I was going to package this properly so that slimey Clojurians can just drop it into their Emacs configs... might just do it sometime soon.

As another option, I seem to have an extremely vague recollection of VimClojure's REPL highlighting user input a long time ago... I definitely could be wrong about this, though.

Oh, and since you're curious about other possible ways to start Clojure REPLs -- all the IDE plugins provide their own REPLs; you could use the regular inferior-lisp-mode in Emacs; java -jar clojure.jar starts a REPL with the current working directory on the classpath; if you embed swank-clojure in your app, you can start REPL servers from within it; VimClojure provides a nice REPLing experience inside Vim (and I believe it provides an equivalent of M-x slime-connect, though, once again, I haven't used it in a pretty long time); you can use Leiningen or clojure-maven-plugin to start stand-alone REPLs or swank instances (I'd expect other Clojure-aware build tools to be capable of this too); cljr can start console REPLs, REPLs packaged in a Swing window and swank instances; there might be more.

Michał Marczyk
The most up-to-date version of the "clojure-mode font lock for SLIME REPL" code is now part of [Phil Hagelberg](http://technomancy.us/)'s new [durendal](http://github.com/technomancy/durendal) project.
Michał Marczyk
+2  A: 

You can start one with Redcar Editor using the Enclojure REPL. This blog post has a screenshot of it in action. It does support colored syntax highlighting. Redcar support for clojure in general isn't great right now, but I am working on improving the experience. If you try it out, let me know what you think.

dbyrne
Oh, this is cool! +1 for improving the Clojure tooling space. :-)
Michał Marczyk
+2  A: 

Cljr is a Clojure REPL and package manager by David Liebke.

It meets the need for a repl for "just trying stuff out". A plain command line repl, a swing repl and a swank server (for use with Emacs SLIME mode) can be started with easily managed clojure and java dependencies available.

Alex Stoddard
+1  A: 

If I'm in Emacs or have an Emacs sitting open somewhere, I typically just use SLIME connected to a swank server. I get a highlighted REPL that way and all the power of Emacs right there in my REPL.

When I don't have Emacs handy, I use cake to start an REPL in a terminal. I don't get highlighting like this, but you can get excellent multiline support and even completion.

Rayne
A: 
#!/bin/bash
# Start Clojure REPL (assumes clojure.jar and clojure-contrib.jar are in /opt/clojure
# Don't remember where I got this originally

# GUI mode
if [ "$TERM" == "dumb" ]; then
    gnome-terminal -t Clojure -x $0 $* &
    exit
fi

breakchars="(){}[],^%$#@\"\";:''|\\"
rlwrap --remember -c -b "$breakchars" \
    java -Djava.ext.dirs=/opt/clojure clojure.main -i $HOME/.clojurerc --repl
lazy1