metabase
The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:
- 50k
- Clojure
- 12 h ago

Emacs support for the Clojure(Script) programming language
Repo clojure-emacs/clojure-mode, read from GitHub 1 min ago. clojure-emacs has not joined Take My Repo.
clojure-emacs/clojure-mode is a public repo on GitHub by clojure-emacs. Emacs support for the Clojure(Script) programming language. It declares no license on GitHub. Public does not mean open source: without a license, nobody is granted the right to reuse it. It is written mainly in Emacs Lisp, has 1,004 stars and last changed on 2026-11-07. Nobody has reviewed it on Take My Repo yet, which says nothing about its quality. Read from GitHub on 2026-11-20.
In the maintainer's words. Shown from GitHub; Take My Repo does not keep a copy.
clojure-mode is an Emacs major mode that provides font-lock (syntax
highlighting), indentation, navigation and refactoring support for the
Clojure(Script) programming language.
clojure-mode requires Emacs 27.1+.
Important
This documentation tracks the master branch of clojure-mode. Some of the
features and settings discussed here might not be available in older releases
(including the current stable release). Please, consult the relevant git tag
(e.g. 5.20.0) if
you need documentation for a specific clojure-mode release.
Available on NonGNU ELPA, MELPA Stable and MELPA.
NonGNU ELPA is configured by default in Emacs 28+, so package-install
will work out of the box without adding any package archives. MELPA
Stable is another good option as it has the latest stable version.
MELPA has a development snapshot for users who don't mind (infrequent)
breakage but don't want to run from a git checkout.
You can install clojure-mode using the following command:
M-x package-install [RET] clojure-mode [RET]
or if you'd rather keep it in your dotfiles:
(unless (package-installed-p 'clojure-mode) (package-install 'clojure-mode))
If the installation doesn't work try refreshing the package list:
M-x package-refresh-contents
The clojure-mode package actually bundles together several major modes:
clojure-mode is a major mode for editing Clojure codeclojurescript-mode is a major mode for editing ClojureScript codeclojurec-mode is a major mode for editing .cljc source filesclojuredart-mode is a major mode for editing ClojureDart .cljd source filesjank-mode is a major mode for editing Jank .jank source filesjoker-mode is a major mode for editing Joker .joke source filesedn-mode is a major mode for editing EDN .edn data filesAll the major modes derive from clojure-mode and provide more or less the same
functionality. Differences can be found mostly in the font-locking -
e.g. ClojureScript has some built-in constructs that are not present in Clojure.
edn-mode is a bit different from the other derived modes -- it's tailored for
data files rather than code. It disables indent specs and forces the
always-align indent style, resulting in simpler indentation appropriate for
data structures.
The proper major mode is selected automatically based on the extension of the file you're editing.
Having separate major modes gives you the flexibility to attach different hooks
to them and to alter their behavior individually (e.g. add extra font-locking
just to clojurescript-mode) .
Note that all modes derive from clojure-mode, so things you add to
clojure-mode-hook and clojure-mode-map will affect all the derived modes as
well.
In the spirit of Emacs, pretty much everything you can think of in clojure-mode is configurable.
To see a list of available configuration options do M-x customize-group RET clojure.
The default indentation rules in clojure-mode are derived from the
community Clojure Style Guide.
Please, refer to the guide for the general Clojure indentation rules.
If you'd like to use the alternative "fixed/tonsky" indentation style you should update your configuration accordingly:
(setq clojure-indent-style 'always-indent clojure-indent-keyword-style 'always-indent clojure-enable-indent-specs nil)
Read on for more details on the available indentation-related configuration options.
By default multi-line docstrings are indented with 2 spaces, as this is a
somewhat common standard in the Clojure community. You can however adjust this
by modifying clojure-docstring-fill-prefix-width. Set it to 0 if you don't
want multi-line docstrings to be indented at all (which is pretty common in most lisps).
The indentation of function forms is configured by the variable
clojure-indent-style. It takes three possible values:
always-align (the default)(some-function 10 1 2) (some-function 10 1 2)
always-indent(some-function 10 1 2) (some-function 10 1 2)
align-arguments(some-function 10 1 2) (some-function 10 1 2)
Note
Prior to clojure-mode 5.10, the configuration options for clojure-indent-style used to be
keywords, but now they are symbols. Keywords will still be supported at least until clojure-mode 6.
Similarly we have the clojure-indent-keyword-style, which works in the following way:
always-align (default) - All
args are vertically aligned with the first arg in case (A),
and vertically aligned with the function name in case (B).(:require [foo.bar] [bar.baz]) (:require [foo.bar] [bar.baz])
always-indent - All args are indented like a macro body.(:require [foo.bar] [bar.baz]) (:x location 0)
align-arguments - Case (A) is indented like always-align, and
case (B) is indented like a macro body.(:require [foo.bar] [bar.baz]) (:x location 0)
The indentation of special forms and macros with bodies is controlled via
put-clojure-indent and define-clojure-indent.
Nearly all special forms and built-in macros with bodies have special indentation
settings in clojure-mode. You can add/alter the indentation settings in your
personal config.
Indent specs use a modern tuple format shared with clojure-ts-mode:
| Spec | Meaning |
|---|---|
'((:block N)) |
First N args are special, rest indented as body |
'((:inner 0)) |
All args indented as body (like defn) |
'((:inner D)) |
Body-style indent at nesting depth D |
'((:inner D I)) |
Body-style at depth D, only at position I |
You can combine multiple rules. For example, let's say you want to indent ->> and -> like this:
(->> something
ala
bala
portokala)You can do so by putting the following in your config:
(put-clojure-indent '-> '((:block 1))) (put-clojure-indent '->> '((:block 1)))
This means that the body of the ->/->> is after the first argument.
A more compact way to do the same thing is:
(define-clojure-indent (-> '((:block 1))) (->> '((:block 1))))
To indent something like a definition (defn) you can do something like:
(put-clojure-indent '>defn '((:inner 0)))
You can also specify different indentation settings for symbols prefixed with some ns (or ns alias):
(put-clojure-indent 'do '((:block 0))) (put-clojure-indent 'my-ns/do '((:block 1)))
Note: A legacy format using integers (e.g., 1), keywords (:defn), and
positional lists (e.g., '(1 ((:defn)) nil)) is also accepted for backward
compatibility. It will be removed in clojure-mode 6.
Certain macros and special forms (e.g. letfn, deftype,
extend-protocol) contain nested sub-forms that each need their
own indentation style. For these, clojure-mode uses backtracking
indentation: when indenting a line, it walks up the sexp tree to
find a parent form with an indent spec, then uses the current
position within that spec to decide how to indent.
Multi-rule specs combine :block and :inner rules to control
nested indentation. For example, letfn uses '((:block 1) (:inner 2 0)):
(letfn [(twice [x] ;; (:block 1) → 1 special arg (the binding vector) (* x 2)) ;; (:inner 2 0) → at depth 2, inside argument 0 (the (thrice [x] ;; binding vector), use body-style indentation (* x 3))] (+ (twice 5) ;; after the block arg → body indentation (thrice 5)))
And defrecord uses '((:block 2) (:inner 1)):
(defrecord MyRecord ;; (:block 2) → 2 special args (name + fields) [field1 field2] SomeProtocol ;; (:inner 1) → nested sub-forms at depth 1 (some-method [this] ;; get body-style indentation (do-stuff this)))
Here are the built-in multi-rule specs:
(define-clojure-indent (letfn '((:block 1) (:inner 2 0))) (deftype '((:block 2) (:inner 1))) (defrecord '((:block 2) (:inner 1))) (defprotocol '((:block 1) (:inner 1))) (definterface '((:block 1) (:inner 1))) (reify '((:inner 0) (:inner 1))) (proxy '((:block 2) (:inner 1))) (extend-protocol '((:block 1) (:inner 1))) (extend-type '((:block 1) (:inner 1))) (specify '((:block 1) (:inner 1))) (specify! '((:block 1) (:inner 1))))
This format is shared with clojure-ts-mode. It also follows the same
rules as the :style/indent metadata specified by cider-nrepl.
For more details on writing indent specifications, see
this document.
Backtracking is controlled by clojure-use-backtracking-indent
(default t) and limited to clojure-max-backtracking levels
(default 3). Disabling backtracking will break indentation for
all forms with multi-rule specs.
The indentation of special
arguments is
controlled by clojure-special-arg-indent-factor, which by default indents
special arguments a further lisp-body-indent when compared to ordinary
arguments.
An example of the default formatting is:
(defrecord MyRecord [my-field])
Note that defrecord has two special arguments, followed by the form's body -
namely the record's name and its fields vector.
Setting clojure-special-arg-indent-factor to 1, results in:
(defrecord MyRecord [my-field])
You can completely disable the effect of indentation specs like this:
(setq clojure-enable-indent-specs nil)
clojure-mode differentiates between comments like ;, ;;, etc.
By default clojure-mode treats ; as inline comments and always indents those.
You can change this behaviour like this:
(add-hook 'clojure-mode-hook (lambda () (setq-local comment-column 0)))
You might also want to change comment-add to 0 in that way, so that Emacs comment
functions (e.g. comment-region) would use ; by default instead of ;;.
Tip
Check out this section of the Clojure
style guide to understand better the semantics of the different comment levels
and why clojure-mode treats them differently by default.
(comment ...)By default, beginning-of-defun and related navigation treat the entire
(comment ...) form as one top-level form. If you'd prefer the forms inside
comment to be treated as top-level (e.g. for evaluation with CIDER), you
can enable this:
(setq clojure-toplevel-inside-comment-form t)
You can vertically align sexps with C-c C-a. For instance, typing
this combo on the following form:
(def my-map {:a-key 1 :other-key 2})
Leads to the following:
(def my-map {:a-key 1 :other-key 2})
This can also be done automatically (as part of indentation) by
turning on clojure-align-forms-automatically. This way it will
happen whenever you select some code and hit TAB.
Several customization options control alignment behavior:
clojure-align-forms-automatically - enable automatic alignment during indentationclojure-align-binding-forms - list of forms with binding pairs to align (e.g. let, loop, for)clojure-align-cond-forms - list of cond-like forms to align (e.g. cond, condp, case)clojure-align-separator - controls whether blank lines prevent alignment within an expressionclojure-align-reader-conditionals - when non-nil, align reader conditionals as if they were mapsclojure-mode features static font-locking (syntax highlighting) that you can
extend yourself if needed. As typical for Emacs, it's based on regular
expressions. You can find the default font-locking rules in
clojure-font-lock-keywords. Here's how you can add font-locking for built-in
Clojure functions and vars:
(defvar clojure-built-in-vars '(;; clojure.core "accessor" "aclone" "agent" "agent-errors" "aget" "alength" "alias" "all-ns" "alter" "alter-meta!" "alter-var-root" "amap" ;; omitted for brevity )) (defvar clojure-built-in-dynamic-vars '(;; clojure.test "*initial-report-counters*" "*load-tests*" "*report-counters*" "*stack-trace-depth*" "*test-out*" "*testing-contexts*" "*testing-vars*" ;; clojure.xml "*current*" "*sb*" "*stack*" "*state*" )) (font-lock-add-keywords 'clojure-mode `((,(concat "(\\(?:\.*/\\)?" (regexp-opt clojure-built-in-vars t) "\\>") 1 font-lock-builtin-face))) (font-lock-add-keywords 'clojure-mode `((,(concat "\\<" (regexp-opt clojure-built-in-dynamic-vars t) "\\>") 0 font-lock-builtin-face)))
Note: The package clojure-mode-extra-font-locking provides such additional
font-locking for Clojure built-ins.
As you might imagine one problem with this font-locking approach is that because
it's based on regular expressions you'll get some false positives here and there
(there's no namespace information, and no way for clojure-mode to know what
var a symbol resolves to). That's why clojure-mode's font-locking defaults are
conservative and minimalistic.
Precise font-locking requires additional data that can obtained from a running REPL (that's how CIDER's dynamic font-locking works) or from static code analysis.
When it comes to non built-in definitions, clojure-mode needs to be manually
instructed how to handle the docstrings and highlighting. Here's an example:
(put '>defn 'clojure-doc-string-elt 2) (font-lock-add-keywords 'clojure-mode `((,(concat "(\\(?:" clojure--sym-regexp "/\\)?" "\\(>defn\\)\\>") 1 font-lock-keyword-face)))
Note
The clojure-doc-string-elt attribute is processed by the function clojure-font-lock-syntactic-face-function.
Here's a summary of the keybindings available in clojure-mode:
| Keybinding | Command |
|---|---|
C-c C-a |
clojure-align |
C-: |
clojure-toggle-keyword-string |
C-c C-r t |
clojure-thread |
C-c C-r u |
clojure-unwind |
C-c C-r f |
clojure-thread-first-all |
C-c C-r l |
clojure-thread-last-all |
C-c C-r p |
clojure-cycle-privacy |
C-c C-r i |
clojure-cycle-if |
C-c C-r w |
clojure-cycle-when |
C-c C-r o |
clojure-cycle-not |
C-c C-r - |
clojure-toggle-discard |
C-c C-r _ |
clojure-toggle-discard-surrounding-form |
C-c C-r P |
clojure-promote-fn-literal |
C-c C-r a |
clojure-add-arity |
C-c C-r k |
clojure-remove-unused-keys |
C-c C-r ( |
clojure-convert-collection-to-list |
C-c C-r ' |
clojure-convert-collection-to-quoted-list |
C-c C-r { |
clojure-convert-collection-to-map |
C-c C-r [ |
clojure-convert-collection-to-vector |
C-c C-r # |
clojure-convert-collection-to-set |
C-c C-r n i |
clojure-insert-ns-form |
C-c C-r n h |
clojure-insert-ns-form-at-point |
C-c C-r n u |
clojure-update-ns |
C-c C-r n s |
clojure-sort-ns |
C-c C-r n r |
clojure-rename-ns-alias |
C-c C-r s i |
clojure-introduce-let |
C-c C-r s m |
clojure-move-to-let |
C-c C-r s f |
clojure-let-forward-slurp-sexp |
C-c C-r s b |
clojure-let-backward-slurp-sexp |
The refactoring prefix C-c C-r is customizable via clojure-refactor-map-prefix.
The available refactorings were originally created and maintained by the
clj-refactor.el team. The ones implemented in Elisp only are gradually migrated
to clojure-mode.
clojure-thread: Thread another form into the surrounding thread. Both ->>
and -> variants are supported.
clojure-unwind: Unwind a threaded expression. Supports both ->> and ->.
clojure-thread-first-all: Introduce the thread first macro (->) and rewrite
the entire form. With a prefix argument do not thread the last form.
clojure-thread-last-all: Introduce the thread last macro and rewrite the
entire form. With a prefix argument do not thread the last form.
clojure-unwind-all: Fully unwind a threaded expression removing the threading
macro.
clojure-cycle-privacy: Cycle privacy of defs or defns. Use metadata
explicitly with setting clojure-use-metadata-for-privacy to t for defns
too.
clojure-cycle-not: Add or remove a not form around the current form.
clojure-cycle-when: Find the closest when or when-not up the syntax tree
and toggle it.
clojure-cycle-if: Find the closest if or if-not up the syntax tree and
toggle it. Also transpose the else and then branches, keeping the semantics
the same as before.
clojure-toggle-discard: Toggle #_ on the form at point, discarding it at the
reader. With a numeric prefix argument, toggle N #_ forms at the same point
(e.g. #_#_ to discard two forms).
clojure-toggle-discard-surrounding-form: Toggle #_ on the surrounding form.
With a numeric prefix argument, go up N levels first. With C-u, act on the
top-level form.
clojure-toggle-discard-defun: Toggle #_ on the top-level form at point.
clojure-promote-fn-literal: Convert a #(...) function literal into a
(fn [...] ...) form, prompting for argument names.
clojure-toggle-keyword-string: Convert the keyword or string at point to the
other type (e.g. :foo becomes "foo" and vice versa).
clojure-insert-ns-form: Insert a namespace form at the beginning of the
buffer, inferred from the file path.
clojure-insert-ns-form-at-point: Insert a namespace form at point.
clojure-update-ns: Update the namespace name to match the file path. Useful
after renaming a file.
clojure-sort-ns: Sort the contents of the ns form (e.g. :require,
:import).
Convert any given collection at point to list, quoted list, map, vector or set.
clojure-introduce-let: Introduce a new let form. Put the current form into
its binding form with a name provided by the user as a bound name. If called
with a numeric prefix put the let form Nth level up in the form hierarchy.
clojure-move-to-let: Move the current form to the closest let's binding
form. Replace all occurrences of the form in the body of the let.
clojure-let-forward-slurp-sexp: Slurp the next form after the let into the
let. Replace all occurrences of the bound forms in the form added to the let
form. If called with a prefix argument slurp the next n forms.
clojure-let-backward-slurp-sexp: Slurp the form before the let into the
let. Replace all occurrences of the bound forms in the form added to the let
form. If called with a prefix argument slurp the previous n forms.
paredit-convolute-sexp is advised to replace occurrences of bound forms with
their bound names when convolute is used on a let form.
clojure-rename-ns-alias: Rename an alias inside a namespace declaration,
and all of its usages in the buffer
If there is an active selected region, only rename usages of aliases within the region, without affecting the namespace declaration.
clojure-add-arity: Add a new arity to an existing single-arity or multi-arity function.
clojure-remove-unused-keys: Remove what the top-level form at point
destructures from maps but doesn't use: names in :keys, :strs and :syms,
:as names and names bound to keys, along with their :or defaults. That
covers arglists (defn, fn, defmethod, letfn, reify and the like) and
the bindings of let, loop, for, doseq and the like. A map with nothing
left becomes _, and one with only its :as name left becomes that name.
(defn handle [{:keys [id user] :or {user "anon"} :as req}] (process id)) ;; becomes (defn handle [{:keys [id]}] (process id))
A name stays when a symbol with that name appears anywhere in its scope, even
if it's a local that shadows it, and so does one starting with _, which marks
it unused on purpose. Positional args and vector destructuring are left alone,
as removing one would change what the others bind.
(require 'clojure-mode-extra-font-locking)
The code in clojure-mode-font-locking used to be bundled with
clojure-mode before version 3.0.
You can also use the code in this package as a basis for extending the font-locking further (e.g. functions/macros from more namespaces). Generally you should avoid adding special font-locking for things that don't have fairly unique names, as this will result in plenty of incorrect font-locking. CIDER users should avoid this package, as CIDER does its own dynamic font-locking, which is namespace-aware and doesn't produce almost any false positives.
clj-refactor provides additional refactoring support.
Enabling CamelCase support for editing commands (like
forward-word, backward-word, etc) in clojure-mode 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 'clojure-mode-hook #'subword-mode)
(add-hook 'clojure-mode-hook #'paredit-mode)
smartparens use the following code:(add-hook 'clojure-mode-hook #'smartparens-strict-mode)
RainbowDelimiters you can
enable it like this:(add-hook 'clojure-mode-hook #'rainbow-delimiters-mode)
clojure-mode is highly
recommended. Provided you've already installed aggressive-indent-mode you can
enable it like this:(add-hook 'clojure-mode-hook #'aggressive-indent-mode)
Note that it might cause performance issues if you're dealing with large Clojure source files.
One of the fundamental aspects of Lisps in general, and Clojure in particular, is the notion of interactive programming - building your programs by continuously changing the state of the running Lisp program (as opposed to doing something more traditional like making a change and re-running the program afterwards to see the changes in action). To get the most of clojure-mode you'll have to combine it with some tool which will allow you to interact with your Clojure program (a.k.a. process/REPL).
A number of options exist for connecting to a running Clojure process and evaluating code interactively.
inf-clojure provides basic interaction with a Clojure REPL process.
It's very similar in nature and supported functionality to inferior-lisp-mode
for Common Lisp.
CIDER is a powerful Clojure interactive development environment, similar to SLIME for Common Lisp.
If you're into Clojure and Emacs you should definitely check it out.
Tutorials, targeting Emacs beginners, are available at clojure-doc.org and Clojure for the Brave and the True. Keep in mind, however, that they might be out-of-date.
clojure-mode is a capable tool, but it's certainly not perfect. This section
lists a couple of general design problems/limitations that might affect your
experience negatively.
clojure-mode derives a lot of functionality directly from lisp-mode (an
Emacs major mode for Common Lisp), which simplified the initial implementation,
but also made it harder to implement certain functionality. Down the road it'd
be nice to fully decouple clojure-mode from lisp-mode.
See this ticket for a bit more details.
clojure-mode's indentation engine is a bit slow due to the
backtracking indentation logic
that walks up the sexp tree for context. You can speed things up
significantly by setting clojure-use-backtracking-indent to nil,
but this will break the indentation of forms with list-based specs
(deftype, defrecord, defprotocol, definterface, reify,
proxy, letfn, extend-type, extend-protocol, specify,
specify!). Simple integer and :defn specs will continue to work.
See this ticket for more details.
As mentioned above, the font-locking is implemented in terms of regular expressions which makes it both slow and inaccurate.
An extensive changelog is available in CHANGELOG.md.
Copyright © 2007-2026 Jeffrey Chu, Lennart Staflin, Phil Hagelberg, Bozhidar Batsov, Artur Malabarba, Magnar Sveen and contributors.
Distributed under the GNU General Public License; type C-h C-c to view it.
clojure-emacs/clojure-mode is a public repo on GitHub by clojure-emacs. Emacs support for the Clojure(Script) programming language.
It declares no license on GitHub. Public does not mean open source: without a license, nobody is granted the right to reuse it.
Its maker has not tagged a system, so it is unknown here. Its README says what it needs.
Open "Take it" on its page: Take My Repo writes an install plan for your machine and hands it to your AI agent (Claude Code, Codex or Cursor), which asks you before each step. Take My Repo has not tested it on any machine.
Its last change on GitHub was on 2026-11-07. Take My Repo does not judge from that whether it is maintained.
Nobody has reviewed it on Take My Repo yet, which says nothing about its quality.

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:
Your AI second brain. Self-hostable. Get answers from the web or your docs. Build custom agents, schedule automations, do deep research. Turn any online or local LLM into your personal, autonomous AI (gpt, claude, gemini, llama, qwen, mistral). Get started - free.
Cool open source projects. Choose your project and get involved in Open Source development now.
A privacy-first, open-source platform for knowledge management and collaboration. Download link: http://github.com/logseq/logseq/releases. roadmap: https://logseq.io/p/NX4mc_ggEV
Emacs client/library for the Language Server Protocol
The Clojure Interactive Development Environment that Rocks for Emacs

A CIDER extension that provides powerful commands for refactoring Clojure code.
A collection of nREPL middleware to enhance Clojure editors with common functionality like definition lookup, code completion, etc.

nREPL middleware to support refactorings in an editor agnostic way
Take My Repo has not tested this on your machine. Requirements come from the project's own documentation.