Function: cider--get-symbol-indent

cider--get-symbol-indent is a byte-compiled function defined in cider-mode.el.

Signature

(cider--get-symbol-indent SYMBOL-NAME)

Documentation

Return the indent metadata for SYMBOL-NAME in the current namespace.

The return value is always in legacy format (integers, :defn, positional lists) for compatibility with all clojure-mode versions. Modern tuple-format specs from the nREPL backend are converted automatically.

Source Code

;; Defined in ~/.emacs.d/elpa/cider-20260414.1619/cider-mode.el
(defun cider--get-symbol-indent (symbol-name)
  "Return the indent metadata for SYMBOL-NAME in the current namespace.
The return value is always in legacy format (integers, :defn,
positional lists) for compatibility with all clojure-mode versions.
Modern tuple-format specs from the nREPL backend are converted
automatically."
  (let* ((ns (let ((clojure-cache-ns t)) ; we force ns caching here for performance reasons
               ;; silence bytecode warning of unused lexical var
               (ignore clojure-cache-ns)
               (cider-current-ns))))
    (if-let* ((meta (cider-resolve-var ns symbol-name))
              (indent (or (nrepl-dict-get meta "style/indent")
                          (nrepl-dict-get meta "indent"))))
        (condition-case-unless-debug err
            (let ((spec (cider--deep-vector-to-list (read indent))))
              ;; Convert modern tuple specs to legacy format so that
              ;; older clojure-mode versions (without modern format
              ;; support) still work correctly.
              (cider--indent-spec-to-legacy spec))
          (error (message ":indent metadata on `%s' is unreadable!\nERROR: %s"
                          symbol-name (error-message-string err))
                 nil))
      ;; There's no indent metadata, but there might be a clojure-mode
      ;; indent-spec with fully-qualified namespace.
      (when (string-match cider-resolve--prefix-regexp symbol-name)
        (when-let* ((sym (intern-soft (replace-match (save-match-data
                                                       (cider-resolve-alias ns (match-string 1 symbol-name)))
                                                     t t symbol-name 1))))
          (get sym 'clojure-indent-function))))))