Function: cider-popup-eval-handler
cider-popup-eval-handler is a byte-compiled function defined in
cider-eval.el.
Signature
(cider-popup-eval-handler &optional BUFFER BOUNDS SOURCE-BUFFER)
Documentation
Make a handler for printing evaluation results in popup BUFFER,
_BOUNDS representing the buffer bounds of the evaled input,
and SOURCE-BUFFER the original buffer
This is used by pretty-printing commands.
Source Code
;; Defined in ~/.emacs.d/elpa/cider-20260414.1619/cider-eval.el
(defun cider-popup-eval-handler (&optional buffer _bounds source-buffer)
"Make a handler for printing evaluation results in popup BUFFER,
_BOUNDS representing the buffer bounds of the evaled input,
and SOURCE-BUFFER the original buffer
This is used by pretty-printing commands."
;; NOTE: cider-eval-register behavior is not implemented here for performance reasons.
;; See https://github.com/clojure-emacs/cider/pull/3162
(let ((chosen-buffer (or buffer (current-buffer))))
(nrepl-make-response-handler
chosen-buffer
;; value handler:
(lambda (buffer value)
(cider-emit-into-popup-buffer buffer (ansi-color-apply value) nil t))
;; stdout handler:
(lambda (_buffer out)
(cider-emit-interactive-eval-output out))
;; stderr handler:
(lambda (_buffer err)
(cider-emit-interactive-eval-err-output err))
;; done handler:
nil
;; eval-error handler:
(lambda (_buffer)
(when (and (buffer-live-p chosen-buffer)
(member (buffer-name chosen-buffer)
cider-ancillary-buffers))
(with-selected-window (get-buffer-window chosen-buffer)
(cider-popup-buffer-quit-function t)))
;; also call the default nrepl-err-handler, so that our custom behavior doesn't void the base behavior:
(when nrepl-err-handler
(funcall nrepl-err-handler source-buffer)))
;; content type handler:
nil
;; truncated handler:
(lambda (buffer warning)
(cider-emit-into-popup-buffer buffer warning 'font-lock-warning-face t)))))