Function: cider-insert-eval-handler
cider-insert-eval-handler is a byte-compiled function defined in
cider-eval.el.
Signature
(cider-insert-eval-handler &optional BUFFER BOUNDS SOURCE-BUFFER ON-SUCCESS-CALLBACK)
Documentation
Make an nREPL evaluation handler for the BUFFER,
_BOUNDS representing the buffer bounds of the evaled input,
SOURCE-BUFFER the original buffer,
and ON-SUCCESS-CALLBACK an optional callback.
The handler simply inserts the result value in BUFFER.
Source Code
;; Defined in ~/.emacs.d/elpa/cider-20260822.1520/cider-eval.el
(defun cider-insert-eval-handler (&optional buffer _bounds source-buffer on-success-callback)
"Make an nREPL evaluation handler for the BUFFER,
_BOUNDS representing the buffer bounds of the evaled input,
SOURCE-BUFFER the original buffer,
and ON-SUCCESS-CALLBACK an optional callback.
The handler simply inserts the result value in BUFFER."
(let ((eval-buffer (current-buffer))
(res "")
(failed nil))
(cider-make-eval-handler
:buffer (or buffer eval-buffer)
:on-value (lambda (value)
(with-current-buffer buffer
(insert value))
(when cider-eval-register
(setq res (concat res value))))
:on-stdout #'cider-repl-emit-interactive-stdout
:on-stderr (lambda (err)
(cider-repl-emit-interactive-stderr err)
;; Don't jump
(cider-handle-compilation-errors err eval-buffer t))
:on-done (lambda ()
(cider--maybe-set-eval-register res)
(when (and (not failed) on-success-callback)
(funcall on-success-callback)))
:on-eval-error (lambda ()
(setq failed t)
(funcall nrepl-err-handler-function source-buffer)))))