Function: put-clojure-indent
put-clojure-indent is a byte-compiled function defined in
clojure-mode.el.
Signature
(put-clojure-indent SYM INDENT)
Documentation
Set the indentation spec of SYM to INDENT.
INDENT can be in either the modern or legacy format.
Modern format (preferred, shared with clojure-ts-mode):
- '((:block N)) — N special args, then body
- '((:inner D)) — body-style at nesting depth D
- '((:inner D I)) — depth D, only at position I
- '((:block N) (:inner D)) — combination
Legacy format (to be removed in clojure-mode 6):
- :defn — indent like a function/macro body
- an integer N — N special args, then body
- a quoted positional list — see clojure--find-indent-spec-backtracking
A function can also be used as a custom indentation function.
Examples:
(put-clojure-indent 'when '((:block 1)))
(put-clojure-indent 'defn '((:inner 0)))
(put-clojure-indent 'letfn '((:block 1) (:inner 2 0)))
;; Legacy forms also accepted:
(put-clojure-indent 'when 1)
(put-clojure-indent '>defn :defn)
Source Code
;; Defined in ~/.emacs.d/elpa/clojure-mode-20260325.811/clojure-mode.el
;;; Setting indentation
(defun put-clojure-indent (sym indent)
"Set the indentation spec of SYM to INDENT.
INDENT can be in either the modern or legacy format.
Modern format (preferred, shared with clojure-ts-mode):
- \\='((:block N)) — N special args, then body
- \\='((:inner D)) — body-style at nesting depth D
- \\='((:inner D I)) — depth D, only at position I
- \\='((:block N) (:inner D)) — combination
Legacy format (to be removed in clojure-mode 6):
- `:defn' — indent like a function/macro body
- an integer N — N special args, then body
- a quoted positional list — see `clojure--find-indent-spec-backtracking'
A function can also be used as a custom indentation function.
Examples:
(put-clojure-indent \\='when \\='((:block 1)))
(put-clojure-indent \\='defn \\='((:inner 0)))
(put-clojure-indent \\='letfn \\='((:block 1) (:inner 2 0)))
;; Legacy forms also accepted:
(put-clojure-indent \\='when 1)
(put-clojure-indent \\='>defn :defn)"
;; Store the modern format canonically.
(put sym 'clojure-indent-spec
(clojure--indent-spec-to-modern indent))
;; Store the legacy format for the backtracking engine.
(put sym 'clojure-indent-function
(if (clojure--modern-indent-spec-p indent)
(clojure--indent-spec-to-legacy indent)
indent)))