Function: cider-eval-pprint-with-multiline-comment-handler
cider-eval-pprint-with-multiline-comment-handler is a byte-compiled
function defined in cider-eval.el.
Signature
(cider-eval-pprint-with-multiline-comment-handler BUFFER LOCATION COMMENT-PREFIX CONTINUED-PREFIX COMMENT-POSTFIX)
Documentation
Make a handler for evaluating and inserting results in BUFFER.
The inserted text is pretty-printed and region will be commented. LOCATION is the location marker at which to insert. Any existing eval comment on the following line is replaced. COMMENT-PREFIX is the comment prefix for the first line of output. CONTINUED-PREFIX is the comment prefix to use for the remaining lines. COMMENT-POSTFIX is the text to output after the last line.
Source Code
;; Defined in ~/.emacs.d/elpa/cider-20260822.1520/cider-eval.el
(defun cider-eval-pprint-with-multiline-comment-handler (buffer location comment-prefix continued-prefix comment-postfix)
"Make a handler for evaluating and inserting results in BUFFER.
The inserted text is pretty-printed and region will be commented.
LOCATION is the location marker at which to insert.
Any existing eval comment on the following line is replaced.
COMMENT-PREFIX is the comment prefix for the first line of output.
CONTINUED-PREFIX is the comment prefix to use for the remaining lines.
COMMENT-POSTFIX is the text to output after the last line."
(let ((res "")
(stderr "")
(location (copy-marker location)))
(cider-make-eval-handler
:buffer buffer
:on-value (lambda (value) (setq res (concat res value)))
;; Forward stdout to the usual interactive sink so output like the
;; `time' macro's "Elapsed time" line isn't silently dropped (#3732).
:on-stdout #'cider-emit-interactive-eval-output
:on-stderr (lambda (err) (setq stderr (concat stderr err)))
:on-done (lambda ()
(with-current-buffer buffer
(save-excursion
(goto-char (marker-position location))
;; Replace an existing eval comment on the following line
(cider-maybe-delete-multiline-comment comment-prefix continued-prefix comment-postfix)
;; edge case: defun at eob
(unless (bolp) (insert "\n"))
(cider-maybe-insert-multiline-comment
(if (or (string-blank-p res)
(string-blank-p stderr))
(string-trim (concat res stderr))
(concat res "\n" (string-trim stderr)))
comment-prefix continued-prefix comment-postfix)))
(cider--maybe-set-eval-register res)))))