Function: nrepl-make-response-handler
nrepl-make-response-handler is a byte-compiled function defined in
nrepl-client.el.
This function is obsolete since 1.22; use nrepl-make-eval-handler
instead.
Signature
(nrepl-make-response-handler BUFFER VALUE-HANDLER STDOUT-HANDLER STDERR-HANDLER DONE-HANDLER &optional EVAL-ERROR-HANDLER CONTENT-TYPE-HANDLER TRUNCATED-HANDLER)
Documentation
Make a response handler for connection BUFFER.
This is the legacy positional-arg form retained for backward
compatibility with extensions. New code should use
nrepl-make-eval-handler (transport-only) or, in CIDER, the higher-
level cider-make-eval-handler which layers UI concerns on top.
The shim adapts the (BUFFER VALUE)-style sub-handlers expected here to
the simpler (VALUE)-style sub-handlers of nrepl-make-eval-handler,
and additionally wires up the global handler hooks
\(nrepl-namespace-handler-function, nrepl-err-handler-function,
nrepl-need-input-handler-function) and the legacy status messages
that used to live inside nrepl-make-eval-handler itself. Anything
that was visible behavior of the original 7-positional-arg API stays
visible behavior here.
VALUE-HANDLER, STDOUT-HANDLER, STDERR-HANDLER, DONE-HANDLER and EVAL-ERROR-HANDLER each receive BUFFER as their first argument; the optional CONTENT-TYPE-HANDLER receives BUFFER plus content and content type; TRUNCATED-HANDLER receives BUFFER alone. Any handler given as nil results in the corresponding response branch being a no-op.
Source Code
;; Defined in ~/.emacs.d/elpa/cider-20260822.1520/nrepl-client.el
(defun nrepl-make-response-handler (buffer value-handler stdout-handler
stderr-handler done-handler
&optional eval-error-handler
content-type-handler
truncated-handler)
"Make a response handler for connection BUFFER.
This is the legacy positional-arg form retained for backward
compatibility with extensions. New code should use
`nrepl-make-eval-handler' (transport-only) or, in CIDER, the higher-
level `cider-make-eval-handler' which layers UI concerns on top.
The shim adapts the (BUFFER VALUE)-style sub-handlers expected here to
the simpler (VALUE)-style sub-handlers of `nrepl-make-eval-handler',
and additionally wires up the global handler hooks
\\(`nrepl-namespace-handler-function', `nrepl-err-handler-function',
`nrepl-need-input-handler-function') and the legacy status messages
that used to live inside `nrepl-make-eval-handler' itself. Anything
that was visible behavior of the original 7-positional-arg API stays
visible behavior here.
VALUE-HANDLER, STDOUT-HANDLER, STDERR-HANDLER, DONE-HANDLER and
EVAL-ERROR-HANDLER each receive BUFFER as their first argument; the
optional CONTENT-TYPE-HANDLER receives BUFFER plus content and content
type; TRUNCATED-HANDLER receives BUFFER alone. Any handler given as nil
results in the corresponding response branch being a no-op."
(declare (obsolete nrepl-make-eval-handler "1.22"))
(nrepl-make-eval-handler
:on-value (when value-handler
(lambda (value) (funcall value-handler buffer value)))
:on-stdout (when stdout-handler
(lambda (out) (funcall stdout-handler buffer out)))
:on-stderr (when stderr-handler
(lambda (err) (funcall stderr-handler buffer err)))
:on-done (when done-handler
(lambda () (funcall done-handler buffer)))
:on-ns (when nrepl-namespace-handler-function
(lambda (ns) (funcall nrepl-namespace-handler-function 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 (and (member "need-input" status)
nrepl-need-input-handler-function)
(funcall nrepl-need-input-handler-function buffer response)))
:on-eval-error (cond (eval-error-handler
(lambda () (funcall eval-error-handler buffer)))
(nrepl-err-handler-function
(lambda () (funcall nrepl-err-handler-function buffer))))
:on-content-type (when content-type-handler
(lambda (decoded type)
(funcall content-type-handler buffer decoded type)))
:on-truncated (when truncated-handler
(lambda () (funcall truncated-handler buffer)))))