Provides Emacs font-lock, indentation, and navigation for the Clojure language.
Available on the Marmalade repo.
If you're not already using Marmalade, add this to your
~/.emacs.d/init.el and load it with
(require 'package) (add-to-list 'package-archives '("marmalade" . "http://marmalade-repo.org/packages/")) (package-initialize)
And then you can install:
M-x package-install [RET] clojure-mode [RET]
(when (not (package-installed-p 'clojure-mode)) (package-install 'clojure-mode))
On Emacs 23 you will need to get package.el
yourself or install manually by placing
clojure-mode.el on your
Clojure Test Mode
This source repository also includes
provides support for running Clojure tests (using the
framework) via nrepl.el or SLIME and seeing feedback in the test
buffer about which tests failed or errored. The installation
instructions above should work for clojure-test-mode as well.
(nrepl.el support is still in progress.)
Once you have a repl session active, you can run the tests in the
current buffer with
C-c C-,. Failing tests and errors will be
highlighted using overlays. To clear the overlays, use
You can jump between implementation and test files with
C-c t if
your project is laid out in a way that clojure-test-mode expects. Your
project root should have a
src/ directory containing files that
correspond to their namespace. It should also have a
containing files that correspond to their namespace, and the test
namespaces should mirror the implementation namespaces with the
addition of "-test" as the suffix to the last segment of the namespace.
my.project.frob would be found in
its tests would be in
test/my/project/frob_test.clj in the
Using clojure-mode with paredit is highly recommended. It is also available using package.el from the above archive.
Use paredit as you normally would with any other mode; for instance:
;; (require 'paredit) if you didn't install via package.el (defun turn-on-paredit () (paredit-mode 1)) (add-hook 'clojure-mode-hook 'turn-on-paredit)
See the cheat sheet for paredit usage hints.
A number of options exist for connecting to a running Clojure process and evaluating code interactively.
Use M-x run-lisp to open a simple REPL subprocess using Leiningen. Once that has opened, you can use C-c C-r to evaluate the region or C-c C-l to load the whole file.
If you don't use Leiningen, you can set
a different REPL command.
Another option is Ritz, which is a bit more complicated but offers advanced debugging functionality using SLIME.
SLIME is also available via swank-clojure, though it is no longer actively maintained.
Copyright © 2007-2012 Jeffrey Chu, Lennart Staflin, Phil Hagelberg, and contributors.
Distributed under the GNU General Public License; see C-h t to view.