Function: cider-need-input
cider-need-input is a byte-compiled function defined in
cider-client.el.
Signature
(cider-need-input BUFFER &optional RESPONSE)
Documentation
Handle a need-input request from BUFFER.
Read a line at the minibuffer and send it to the blocked evaluation.
Cancelling the prompt interrupts that evaluation instead: the previous
behavior sent nil, which bencodes to an empty list rather than a string - a
type-incorrect stdin op that nREPL treated as EOF, so cancelling silently
ended the read and let the evaluation continue instead of cancelling it.
RESPONSE is the nREPL need-input response (the message whose status is
"need-input"). When given, its session selects the exact connection to
answer (important with several connections) and its id lets a cancel
interrupt just the blocked evaluation. Without it, both fall back to
cider-current-repl and a connection-wide interrupt.
At the prompt, \RET sends the line, cider-need-input-send-eof sends
end-of-input, and cancelling (quit) interrupts the evaluation.
Source Code
;; Defined in ~/.emacs.d/elpa/cider-20260822.1520/cider-client.el
(defun cider-need-input (buffer &optional response)
"Handle a need-input request from BUFFER.
Read a line at the minibuffer and send it to the blocked evaluation.
Cancelling the prompt interrupts that evaluation instead: the previous
behavior sent nil, which bencodes to an empty list rather than a string - a
type-incorrect `stdin' op that nREPL treated as EOF, so cancelling silently
ended the read and let the evaluation continue instead of cancelling it.
RESPONSE is the nREPL need-input response (the message whose status is
\"need-input\"). When given, its `session' selects the exact connection to
answer (important with several connections) and its `id' lets a cancel
interrupt just the blocked evaluation. Without it, both fall back to
`cider-current-repl' and a connection-wide interrupt.
At the prompt, \\`RET' sends the line, `cider-need-input-send-eof' sends
end-of-input, and cancelling (quit) interrupts the evaluation."
(with-current-buffer buffer
(let* ((session (and response (nrepl-dict-get response "session")))
(id (and response (nrepl-dict-get response "id")))
(repl (or (cider--connection-for-session session)
(cider-current-repl)))
(map (make-sparse-keymap)))
(set-keymap-parent map minibuffer-local-map)
(define-key map (kbd "C-c C-c") #'abort-recursive-edit)
(define-key map (kbd "C-c C-d") #'cider-need-input-send-eof)
(condition-case nil
(let* ((cider-need-input--eof nil)
(input (read-from-minibuffer (cider-need-input--prompt repl) nil map)))
;; An empty string is what nREPL turns into EOF; a line otherwise.
(nrepl-request:stdin (if cider-need-input--eof "" (concat input "\n"))
(cider-stdin-handler buffer)
repl))
(quit
(when (buffer-live-p repl)
(if id
(nrepl-request:interrupt id (cider-interrupt-handler repl) repl)
(cider-interrupt-repl repl))))))))