There are many additional Emacs packages that can enhance your Clojure programming
experience. The majority of the minor modes listed here should be enabled for both
clojure-mode for optimal effects.
The packages listed here belong to three categories:
Generic Emacs packages useful for Clojure programming
|Make sure that the version of any extension you’ve installed is compatible with your CIDER version.|
CIDER extensions typically are Emacs packages that built on top of CIDER’s Emacs Lisp API.
Some of them ship with extra nREPL middleware as well (e.g.
packages that rely on middleware would hook into CIDER’s middleware injection
functionality and inject their own functionality automatically as well.
|Keep in mind that currently there are no "official" CIDER extensions and the packages on the list are not maintained by CIDER’s Core Team. Their quality and level of maintenance may vary significantly.|
clj-refactor builds on top
clojure-mode and CIDER and adds a ton of extra functionality (e.g. the
ability to thread/unthread expression, find and replace usages, introduce let
bindings, extract function and so on).
A full list of features is available here.
We hope to incorporate some of its features into
clojure-mode and CIDER themselves
down the road.
Emidje extends CIDER to provide support for Midje tests in a similar
cider-test.el does for
clojure.test tests. In fact, most of
Emidje’s functionalities were strongly inspired by
kaocha-runner provides Kaocha integration for Emacs.
helm-cider provides a Helm
interface for certain CIDER commands (e.g.
cider-hydra provides a nice way to navigate groups of related CIDER commands.
You can think of it as a fancier which-key.
flycheck-clj-kondo is a Flycheck checker for Clojure that provides instant linting of clojure code as you type, via clj-kondo.
clj-kondo is a great way of preventing yourself from writing buggy code.
squiggly-clojure is a Flycheck checker for Clojure, using tools like eastwood, core.typed and kibit.
sayid is a powerful alternative of CIDER’s built-in basic tracing functionality.
Generic Emacs Extensions
Most packages in the following list are standard Emacs minor modes that work with most major modes, but are especially handy for Lisp-like languages like Clojure.
CamelCase support for editing commands(like
backward-word, etc) in the REPL is quite useful since
we often have to deal with Java class and method names. The built-in
Emacs minor mode
subword-mode provides such functionality:
(add-hook 'cider-repl-mode-hook #'subword-mode)
The use of paredit
when editing Clojure (or any other Lisp) code is highly
recommended. You’re probably using it already in your
buffers (if you’re not you probably should). You might also want to
paredit in the REPL buffer as well:
(add-hook 'cider-repl-mode-hook #'paredit-mode)
smartparens is an excellent alternative
to paredit. Many Clojure hackers have adopted it recently and you might want
to give it a try as well. To enable
smartparens in the REPL buffer use the
(add-hook 'cider-repl-mode-hook #'smartparens-strict-mode)
RainbowDelimiters is a minor mode which highlights parentheses, brackets, and braces according to their depth. Each successive level is highlighted in a different color. This makes it easy to spot matching delimiters, orient yourself in the code, and tell which statements are at a given depth. Assuming you’ve already installed RainbowDelimiters you can enable it in the REPL like this:
(add-hook 'cider-repl-mode-hook #'rainbow-delimiters-mode)
eval-sexp-fu provides some visual
feedback when evaluating expressions. cider-eval-sexp-fu provides
CIDER integration for
It’s generally a bad idea to mix Clojure programming environments, as all of those
tend to modify
This section enumerates other Emacs packages that provide a Clojure programming environment for Emacs.
This package provides basic interaction with a Clojure subprocess (REPL). It’s based on ideas from the popular inferior-lisp package.
inf-clojure has two components -
a nice Clojure REPL with auto-completion and a minor mode
inf-clojure-minor-mode), which extends clojure-mode with commands to evaluate
forms directly in the REPL.
It’s basically a simple alternative of CIDER, which provides a subset of CIDER’s functionality.