Function: nrepl-log--pp-listlike
nrepl-log--pp-listlike is a byte-compiled function defined in
nrepl-client.el.
Signature
(nrepl-log--pp-listlike OBJECT &optional FACE BUTTON)
Documentation
Pretty print nREPL list like OBJECT.
FACE and BUTTON are as in nrepl-log-pp-object.
Source Code
;; Defined in ~/.emacs.d/elpa/cider-20260822.1520/nrepl-client.el
(defun nrepl-log--pp-listlike (object &optional face button)
"Pretty print nREPL list like OBJECT.
FACE and BUTTON are as in `nrepl-log-pp-object'."
(cl-flet ((color (str)
(propertize str 'face
(if face
(list '(:weight ultra-bold) face)
'(:weight ultra-bold)))))
(let ((head (format "(%s" (car object))))
(insert (color head))
(if (null (cdr object))
(insert ")\n")
;; Walk the plist once: bucket pairs whose key is in
;; `nrepl-log--special-keys' into a fixed-position vector so they
;; emit in canonical order, collect the rest in insertion order,
;; and track the widest key for column alignment. Replaces a
;; pipeline that copy-sequence'd, partitioned, sorted, mapped,
;; filtered, removed, and concatenated the plist for every message.
(let* ((indent (+ 2 (- (current-column) (length head))))
(specials (make-vector (length nrepl-log--special-keys) nil))
(others nil)
(longest-name 0))
(cl-loop for (k v) on (cdr object) by #'cddr
do (setq longest-name (max longest-name (length k)))
do (let ((idx (cl-position k nrepl-log--special-keys :test #'equal)))
(if idx
(aset specials idx (cons k v))
(push (cons k v) others))))
(insert "\n")
(let ((indent-str (make-string indent ?\s))
;; Only highlight top-level keys.
(face (unless (eq (car object) 'dict) 'font-lock-keyword-face)))
(dolist (pair (nconc (delq nil (append specials nil)) (nreverse others)))
(let* ((k (car pair))
(v (cdr pair))
(spaces-str (make-string (- longest-name (length k)) ?\s)))
(insert indent-str (propertize k 'face face) spaces-str " ")
(nrepl-log-pp-object v nil button))))
(when (eq (car object) 'dict)
(delete-char -1))
(insert (color ")\n")))))))