Function: cider-repl--font-lock-result-region
cider-repl--font-lock-result-region is a byte-compiled function
defined in cider-repl.el.
Signature
(cider-repl--font-lock-result-region BEG END)
Documentation
Overlay Clojure font-lock faces on the result text between BEG and END.
The text is already inserted; this fontifies the now-complete value in a
single pass and copies the resulting faces back in place, so a value that
nREPL split across several chunks is highlighted as one balanced form.
Unbalanced or over-long values (see cider-font-lock-max-length) are left
untouched, matching cider-font-lock-as-clojure.
Source Code
;; Defined in ~/.emacs.d/elpa/cider-20260822.1520/cider-repl.el
(defun cider-repl--font-lock-result-region (beg end)
"Overlay Clojure font-lock faces on the result text between BEG and END.
The text is already inserted; this fontifies the now-complete value in a
single pass and copies the resulting faces back in place, so a value that
nREPL split across several chunks is highlighted as one balanced form.
Unbalanced or over-long values (see `cider-font-lock-max-length') are left
untouched, matching `cider-font-lock-as-clojure'."
(let* ((raw (buffer-substring-no-properties beg end))
(fontified (cider-font-lock-as-clojure raw)))
;; `cider-font-lock-as-clojure' returns RAW unchanged (`eq') when it bails
;; out (unbalanced or too long); only rewrite faces when it actually ran,
;; and only when lengths line up so offsets map 1:1.
(when (and (not (eq fontified raw))
(= (length fontified) (length raw)))
(with-silent-modifications
;; Drop the base result face, then transfer the Clojure faces.
(remove-text-properties beg end '(font-lock-face nil))
(let ((i 0) (n (length fontified)))
(while (< i n)
(let ((next (or (next-single-property-change i 'face fontified) n))
(face (get-text-property i 'face fontified)))
(when face
(put-text-property (+ beg i) (+ beg next) 'face face))
(setq i next))))))))