Function: clojure--normal-indent
clojure--normal-indent is a byte-compiled function defined in
clojure-mode.el.
Signature
(clojure--normal-indent LAST-SEXP INDENT-MODE)
Documentation
Return the normal indentation column for a sexp.
Point should be after the open paren of the _enclosing_ sexp, and
LAST-SEXP is the start of the previous sexp (immediately before
the sexp being indented). INDENT-MODE is any of the values
accepted by clojure-indent-style.
Source Code
;; Defined in ~/.emacs.d/elpa/clojure-mode-20260325.811/clojure-mode.el
(defun clojure--normal-indent (last-sexp indent-mode)
"Return the normal indentation column for a sexp.
Point should be after the open paren of the _enclosing_ sexp, and
LAST-SEXP is the start of the previous sexp (immediately before
the sexp being indented). INDENT-MODE is any of the values
accepted by `clojure-indent-style'."
(goto-char last-sexp)
(forward-sexp 1)
(clojure-backward-logical-sexp 1)
(let ((last-sexp-start nil))
(if (ignore-errors
;; `backward-sexp' until we reach the start of a sexp that is the
;; first of its line (the start of the enclosing sexp).
(while (save-excursion
(skip-chars-backward " \t")
(not (bolp)))
(setq last-sexp-start (prog1 (point)
(forward-sexp -1))))
t)
;; Here we have found an arg before the arg we're indenting which is at
;; the start of a line. Every mode simply aligns on this case.
(current-column)
;; Here we have reached the start of the enclosing sexp (point is now at
;; the function name), so the behaviour depends on INDENT-MODE and on
;; whether there's also an argument on this line (case A or B).
(let ((indent-mode (if (keywordp indent-mode)
;; needed for backwards compatibility
;; as before clojure-mode 5.10 indent-mode was a keyword
(clojure--keyword-to-symbol indent-mode)
indent-mode))
(case-a ; The meaning of case-a is explained in `clojure-indent-style'.
(and last-sexp-start
(< last-sexp-start (line-end-position)))))
(cond
((eq indent-mode 'always-indent)
(+ (current-column) lisp-body-indent -1))
;; There's an arg after the function name, so align with it.
(case-a (goto-char last-sexp-start)
(current-column))
;; Not same line.
((eq indent-mode 'align-arguments)
(+ (current-column) lisp-body-indent -1))
;; Finally, just align with the function name.
(t (current-column)))))))