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. 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-20260414.1619/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.
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 ""))
    (nrepl-make-response-handler
     buffer
     (lambda (_buffer value)
       (setq res (concat res value)))
     nil
     (lambda (_buffer err)
       (setq res (concat res err)))
     (lambda (buffer)
       (with-current-buffer buffer
         (save-excursion
           (goto-char (marker-position location))
           ;; edge case: defun at eob
           (unless (bolp) (insert "\n"))
           (cider-maybe-insert-multiline-comment res comment-prefix continued-prefix comment-postfix)))
       (when cider-eval-register
         (set-register cider-eval-register res)))
     nil
     nil
     (lambda (_buffer warning)
       (setq res (concat res warning))))))