Function: cider-inspector--render-value

cider-inspector--render-value is a byte-compiled function defined in cider-inspector.el.

Signature

(cider-inspector--render-value DICT-OR-VALUE &optional POINT-ACTION)

Documentation

Render DICT-OR-VALUE.

It can either be a value directly or a inspector response that contains value field. POINT-ACTION can either be nil (leave point where it is now), :pop (pop point from stack), :next-inspectable (move point to next inspectable object).

Source Code

;; Defined in ~/.emacs.d/elpa/cider-20260414.1619/cider-inspector.el
;; Render Inspector from Structured Values
(defun cider-inspector--render-value (dict-or-value &optional point-action)
  "Render DICT-OR-VALUE.
It can either be a value directly or a inspector response that contains
`value' field.
POINT-ACTION can either be nil (leave point where it is now), `:pop' (pop point
from stack), `:next-inspectable' (move point to next inspectable object)."
  (let* ((value (if (nrepl-dict-p dict-or-value)
                    (nrepl-dict-get dict-or-value "value")
                  dict-or-value))
         (ns (cider-current-ns))
         (font-size (when-let* ((b (get-buffer cider-inspector-buffer))
                                (variable 'text-scale-mode-amount)
                                (continue (local-variable-p variable b)))
                      ;; The font size is lost between inspector 'screens',
                      ;; because on each re-rendering, we wipe everything, including the mode.
                      ;; Enabling cider-inspector-mode is the specific step that loses the font size.
                      (buffer-local-value variable b)))
         (truncate-lines-defined (when-let* ((b (get-buffer cider-inspector-buffer)))
                                   (local-variable-p 'truncate-lines b)))
         (truncate-lines-p (when-let* ((b (get-buffer cider-inspector-buffer))
                                       (continue truncate-lines-defined))
                             (buffer-local-value 'truncate-lines b)))
         (repl (cider-current-repl))
         (current-point (point)))
    (cider-make-popup-buffer cider-inspector-buffer 'cider-inspector-mode 'ancillary)
    (cider-inspector-render cider-inspector-buffer value
                            :font-size font-size
                            :truncate-lines-defined truncate-lines-defined
                            :truncate-lines-p truncate-lines-p)
    (cider-popup-buffer-display cider-inspector-buffer cider-inspector-auto-select-buffer)
    (when cider-inspector-fill-frame (delete-other-windows))
    (with-current-buffer cider-inspector-buffer
      (setq cider--ancillary-buffer-repl repl)
      (cider-set-buffer-ns ns)
      (cond ((eq point-action nil) (goto-char current-point))
            ((eq point-action :next-inspectable) (ignore-errors (cider-inspector-next-inspectable-object 1)))
            ((eq point-action :pop)
             (goto-char (or (when cider-inspector-location-stack
                              (pop cider-inspector-location-stack))
                            current-point)))))))