# clojure-mode, one Emacs major mode for seven Lisp dialects

> clojure-mode gives Emacs font-lock, indentation, navigation and refactoring for Clojure, and the package actually bundles seven major modes covering ClojureScript, cljc, ClojureDart, Jank, Joker and EDN. The indentation engine is the substance of the project, and it is documented down to the indent spec format.

**clojure-emacs/clojure-mode** — Emacs support for the Clojure(Script) programming language

- Repository: https://github.com/clojure-emacs/clojure-mode
- Stars: 1,002 · Forks: 249
- Language: Emacs Lisp
- License: not declared
- Published: 2026-10-19 · Updated: 2026-10-19 · Language: en
- Canonical page: https://hysenlabs.com/projects/clojure-emacs-clojure-mode

## A package that ships seven major modes

clojure-mode is an Emacs major mode providing font-lock, indentation, navigation and refactoring support for Clojure, and the package bundles more than one mode under that name. There is clojure-mode for Clojure source, clojurescript-mode for ClojureScript, clojurec-mode for .cljc files, clojuredart-mode for .cljd files, jank-mode for .jank files, joker-mode for .joke files and edn-mode for .edn data files. All of them derive from clojure-mode and behave in much the same way, with the differences mostly in font-locking, because ClojureScript has constructs that Clojure does not. edn-mode is the exception the documentation calls out: it is tailored to data rather than code, switches off the indent specs and pins the indentation style to always-align, which keeps data structures simple to read. The right mode is selected automatically from the file extension, and separate modes exist so you can attach different hooks to each, for example extra font-locking only in clojurescript-mode.

## Indentation defaults to the community style guide

The default indentation rules follow the community Clojure Style Guide, and the documentation points you there for the general rules rather than restating them. What the mode does add is the machinery to change them. The variable clojure-indent-style governs function forms and takes three values. always-align is the default, aligning arguments with the function name when the form wraps and with the first argument when it does not. always-indent indents every argument like a macro body. align-arguments mixes the two, using body style in the wrapped case and alignment in the unwrapped one. A separate variable, clojure-indent-keyword-style, applies the same three choices to keyword arguments such as the:require forms in a namespace declaration, with always-align as its default. Docstring indentation has its own knob, clojure-docstring-fill-prefix-width, which is two spaces by default and can be set to 0 if you prefer docstrings not indented at all, as is common in other Lisps.

## Indent specs in a modern tuple format

Special forms and macros with bodies are controlled through put-clojure-indent and define-clojure-indent, and nearly all built-in special forms and macros already have settings in the mode. The format used for those settings uses a modern tuple format, the same one clojure-ts-mode uses, and it is a small specification worth knowing because it is what you write when you need behaviour the defaults do not give you. The block form marks the leading arguments as special and indents the rest as a body. The inner form indents all arguments as a body, exactly as defn does. The inner form also takes a nesting depth, so the body style applies at that depth only, and a second value that restricts it to a specific argument position. Multiple rules can be combined, and the documentation gives a worked example of indenting the threading macros in a particular way. What matters here is that the tuple format is shared with clojure-ts-mode.

## Installing it and putting it in your dotfiles

The mode requires Emacs 27.1 or newer. It is published to NonGNU ELPA, MELPA Stable and MELPA, and Emacs 28 and later ship with NonGNU ELPA enabled, so the package installation command works without adding any package archives. The dotfiles route installs it on first use if it is missing.

```elisp
(unless (package-installed-p 'clojure-mode)
  (package-install 'clojure-mode))
```

If the install does not work, the documentation says to refresh the package list with the package-refresh-contents command. Which archive you pick is the interesting decision. MELPA Stable has the latest stable version, while MELPA serves a development snapshot for users who accept infrequent breakage but do not want to run from a git checkout. The configuration options are all discoverable through the customize group, where the group named clojure lists everything that can be set.

## Hooks and keymaps leak into every derived mode

Because all the modes derive from clojure-mode, anything you add to clojure-mode-hook or clojure-mode-map affects all the derived modes as well. That is deliberate, and it is also the first surprise. The advantage is that one hook can adjust indentation or font-locking for every dialect at once, and the documentation notes the appeal of the Emacs tradition that pretty much everything in the mode is configurable. The downside is that a hook written with Clojure in mind will also fire when you open a .cljd, .jank, .joke or .edn file, and a rule tuned for code will misbehave on EDN data. The separate modes exist precisely so you can target them individually, but the base mode is still the parent, and there is no way to opt a derived mode out of the parent hook.

## The documentation describes master, not your installed version

The documentation opens with a warning that is easy to skip. It tracks the master branch, and some of the features and settings discussed may be missing from older releases, the current stable one included. The advice is to consult the relevant git tag, for example the 5.20.0 tree, when you want the documentation that matches one particular clojure-mode release. This matters concretely for the configuration variables, because the release notes also record a change in 5.10 where the clojure-indent-style options were keywords before that release and are symbols now, with keyword support promised at least until clojure-mode 6. If you copy an always-align snippet from a blog post written years ago and it silently does nothing, this is the reason. The practical habit is to read the CHANGELOG.md in the repository, which is where the release-to-release differences are recorded, rather than assuming the documentation describes what you have installed.

## Byte-compile warnings are treated as errors

The development toolchain is Eldev, driven by a small Makefile with clean, compile, lint, test and all targets. The compile target runs a byte-compilation pass with warnings treated as errors, and the lint target runs the linter in check mode. The test target runs the test suite, and the repository carries test.clj alongside a test directory, which suggests the tests are partly expressed in Clojure itself. The default goal is all, so a plain make runs the whole chain. The cost of that policy is visible in the release history. Versions v5.21.0, v5.22.0 and v5.23.0 shipped on 2026-02-18, 2026-03-03 and 2026-03-25 respectively, three releases inside about five weeks, and the last push was on 2026-09-15, so the branch is active and the tags are frequent. The repository is not archived, the CI workflow has its own badge, and there is a Discord channel for questions. The project page carries a GPL 3 badge, while GitHub could not classify the project licence, so the licence file in the tree is the one to read.

## Conclusion

clojure-mode fits an Emacs user writing Clojure or ClojureScript who wants the community style guide applied by default and the ability to override any of it, and it fits a team that cares about the indentation of a Lisp with few hard rules. It does not fit a team that wants the same editing experience in every editor, since this is an Emacs major mode with no other front end, and it does not fit a person who expects the documentation to match the installed release, because the upstream notes track the master branch and say so. Verify three things before you configure it: the Emacs version, since 27.1 or newer is required, whether the version you install from MELPA Stable matches the settings you are copying, and the difference between the keyword and symbol forms of the indentation options, which changed in 5.10.

## FAQ

### What is clojure-mode?

It is an Emacs major mode providing font-lock, indentation, navigation and refactoring support for Clojure, and it requires Emacs 27.1 or newer. The package also bundles clojurescript-mode, clojurec-mode, clojuredart-mode, jank-mode, joker-mode and edn-mode, all derived from it.

### How do I install clojure-mode in Emacs?

It is available on NonGNU ELPA, MELPA Stable and MELPA, and Emacs 28 and later enable NonGNU ELPA out of the box, so package installation works without extra archives. In dotfiles you can guard it with a package-installed-p check around a package-install call.

### How do I change the indentation style in clojure-mode?

Set clojure-indent-style for function forms and clojure-indent-keyword-style for keyword arguments, each taking always-align, always-indent or align-arguments, and set clojure-docstring-fill-prefix-width to control docstring indentation. The default rules follow the community Clojure Style Guide.

### What indent spec forms does put-clojure-indent accept?

The documentation describes a modern tuple format shared with clojure-ts-mode, with a block form for the leading arguments as special, an inner form for all arguments as body, an inner form with a nesting depth, and an inner form with a depth and a position that restricts it to one argument. Multiple rules can be combined.

## Sources

- [clojure-emacs/clojure-mode on GitHub](https://github.com/clojure-emacs/clojure-mode)
- [Issues](https://github.com/clojure-emacs/clojure-mode/issues)
- [README](https://github.com/clojure-emacs/clojure-mode/blob/master/README.md)
- [Releases](https://github.com/clojure-emacs/clojure-mode/releases)

---

Hysen Labs editorial analysis, written from the project's own repository and release notes. Cite the canonical page: https://hysenlabs.com/projects/clojure-emacs-clojure-mode
