Function: nrepl-log-pp-object

nrepl-log-pp-object is a byte-compiled function defined in nrepl-client.el.

Signature

(nrepl-log-pp-object OBJECT &optional FACE BUTTON)

Documentation

Pretty print nREPL OBJECT, its delimiters colored with FACE.

FACE can be a face symbol or an anonymous face. If BUTTON is non-nil, try making a button from OBJECT instead of inserting it into the buffer.

Source Code

;; Defined in ~/.emacs.d/elpa/cider-20260822.1520/nrepl-client.el
(defun nrepl-log-pp-object (object &optional face button)
  "Pretty print nREPL OBJECT, its delimiters colored with FACE.
FACE can be a face symbol or an anonymous face.  If BUTTON is non-nil, try
making a button from OBJECT instead of inserting it into the buffer."
  (let ((min-dict-fold-size   1)
        (min-list-fold-size   10)
        (min-string-fold-size 60))
    (if-let* ((head (car-safe object)))
        ;; list-like objects
        (cond
         ;; top level dicts (always expanded)
         ((memq head '(<-- -->))
          (nrepl-log--pp-listlike object face button))
         ;; inner dicts
         ((eq head 'dict)
          (if (and button (> (length object) min-dict-fold-size))
              (nrepl-log-insert-button "(dict ...)" object)
            (nrepl-log--pp-listlike object face button)))
         ;; lists
         (t
          (if (and button (> (length object) min-list-fold-size))
              (nrepl-log-insert-button (format "(%s ...)" (prin1-to-string head)) object)
            (prin1 object (current-buffer))
            (insert "\n"))))
      ;; non-list objects
      (if (stringp object)
          (if (and button (> (length object) min-string-fold-size))
              (nrepl-log-insert-button (format "\"%s...\"" (substring object 0 min-string-fold-size)) object)
            (insert (prin1-to-string object) "\n"))
        (prin1 object (current-buffer))
        (insert "\n")))))