Function: clojure--get-indent-method

clojure--get-indent-method is a byte-compiled function defined in clojure-mode.el.

Signature

(clojure--get-indent-method FUNCTION-NAME)

Documentation

Return the indent spec for the symbol named FUNCTION-NAME.

FUNCTION-NAME is a string. If it contains a /, also try only the part after the /.

Look for a spec using clojure-get-indent-function, then try the clojure-indent-function and clojure-backtracking-indent symbol properties.

The return value is always in legacy format for consumption by the backtracking indent engine. Modern-format specs from clojure-get-indent-function are converted automatically.

Source Code

;; Defined in ~/.emacs.d/elpa/clojure-mode-20260325.811/clojure-mode.el
(defun clojure--get-indent-method (function-name)
  "Return the indent spec for the symbol named FUNCTION-NAME.
FUNCTION-NAME is a string.  If it contains a `/', also try only
the part after the `/'.

Look for a spec using `clojure-get-indent-function', then try the
`clojure-indent-function' and `clojure-backtracking-indent'
symbol properties.

The return value is always in legacy format for consumption by the
backtracking indent engine.  Modern-format specs from
`clojure-get-indent-function' are converted automatically."
  (or (let ((spec (when (functionp clojure-get-indent-function)
                    (funcall clojure-get-indent-function function-name))))
        (if (clojure--modern-indent-spec-p spec)
            (clojure--indent-spec-to-legacy spec)
          spec))
      (get (intern-soft function-name) 'clojure-indent-function)
      (get (intern-soft function-name) 'clojure-backtracking-indent)
      (when (string-match "/\\([^/]+\\)\\'" function-name)
        (or (get (intern-soft (match-string 1 function-name))
                 'clojure-indent-function)
            (get (intern-soft (match-string 1 function-name))
                 'clojure-backtracking-indent)))
      ;; indent symbols starting with if, when, ...
      ;; such as if-let, when-let, ...
      ;; like if, when, ...
      (when (string-match (rx string-start (or "if" "when" "let" "while") (syntax symbol))
                          function-name)
        (clojure--get-indent-method (substring (match-string 0 function-name) 0 -1)))))