Function: cider-make-eval-handler

cider-make-eval-handler is a byte-compiled function defined in cider-eval.el.

Signature

(cider-make-eval-handler &key BUFFER ON-VALUE ON-STDOUT ON-STDERR ON-DONE ON-EVAL-ERROR ON-CONTENT-TYPE ON-TRUNCATED)

Documentation

Build an eval response handler with CIDER's UI behavior wired in.

This is the editor-level wrapper around nrepl-make-eval-handler: it forwards the standard slots (:on-value, :on-stdout, :on-stderr,
:on-done, :on-content-type, :on-truncated, :on-eval-error) and
additionally:

- updates BUFFER's cider-buffer-ns from the response's ns slot
  (only for non-source buffers, via cider--update-buffer-ns);
- prompts the user via cider-need-input on "need-input" status;
- prints "Evaluation interrupted." on "interrupted" status;
- prints "Namespace `X' not found." on "namespace-not-found" status;
- when no :on-eval-error is given, defaults to a thunk that calls
  cider-default-err-handler with BUFFER.

BUFFER is the editor buffer the response is associated with (typically the one that issued the eval). The other slots (ON-VALUE, ON-STDOUT, ON-STDERR, ON-DONE, ON-EVAL-ERROR, ON-CONTENT-TYPE and ON-TRUNCATED) have the same semantics as in nrepl-make-eval-handler.

Source Code

;; Defined in ~/.emacs.d/elpa/cider-20260822.1520/cider-eval.el
(cl-defun cider-make-eval-handler (&key buffer
                                        on-value on-stdout on-stderr on-done
                                        on-eval-error on-content-type on-truncated)
  "Build an eval response handler with CIDER's UI behavior wired in.

This is the editor-level wrapper around `nrepl-make-eval-handler': it
forwards the standard slots (`:on-value', `:on-stdout', `:on-stderr',
`:on-done', `:on-content-type', `:on-truncated', `:on-eval-error') and
additionally:

- updates BUFFER's `cider-buffer-ns' from the response's `ns' slot
  (only for non-source buffers, via `cider--update-buffer-ns');
- prompts the user via `cider-need-input' on \"need-input\" status;
- prints \"Evaluation interrupted.\" on \"interrupted\" status;
- prints \"Namespace `X' not found.\" on \"namespace-not-found\" status;
- when no `:on-eval-error' is given, defaults to a thunk that calls
  `cider-default-err-handler' with BUFFER.

BUFFER is the editor buffer the response is associated with (typically
the one that issued the eval).  The other slots (ON-VALUE, ON-STDOUT,
ON-STDERR, ON-DONE, ON-EVAL-ERROR, ON-CONTENT-TYPE and ON-TRUNCATED)
have the same semantics as in `nrepl-make-eval-handler'."
  (nrepl-make-eval-handler
   :on-value on-value
   :on-stdout on-stdout
   :on-stderr on-stderr
   :on-done on-done
   :on-content-type on-content-type
   :on-truncated on-truncated
   :on-ns (lambda (ns) (cider--update-buffer-ns buffer ns))
   :on-status (lambda (status response)
                (when (member "interrupted" status)
                  (message "Evaluation interrupted."))
                (when (member "namespace-not-found" status)
                  (nrepl-dbind-response response (ns)
                    (message "Namespace `%s' not found." ns)))
                (when (member "need-input" status)
                  (cider-need-input buffer response)))
   :on-eval-error (or on-eval-error
                      (lambda () (cider-default-err-handler buffer)))))