Function: nrepl-send-request
nrepl-send-request is a byte-compiled function defined in
nrepl-client.el.
Signature
(nrepl-send-request REQUEST CALLBACK CONNECTION &optional TOOLING)
Documentation
Send REQUEST and register response handler CALLBACK using CONNECTION.
REQUEST is a pair list of the form ("op" "operation" "par1-name"
"par1" ... ). See the code of nrepl-request:clone,
nrepl-request:stdin, etc. This expects that the REQUEST does not have a
session already in it. This code will add it as appropriate to prevent
connection/session drift.
Return the ID of the sent message.
Optional argument TOOLING Set to t if desiring the tooling session rather than
the standard session.
Source Code
;; Defined in ~/.emacs.d/elpa/cider-20260414.1619/nrepl-client.el
(defun nrepl-send-request (request callback connection &optional tooling)
"Send REQUEST and register response handler CALLBACK using CONNECTION.
REQUEST is a pair list of the form (\"op\" \"operation\" \"par1-name\"
\"par1\" ... ). See the code of `nrepl-request:clone',
`nrepl-request:stdin', etc. This expects that the REQUEST does not have a
session already in it. This code will add it as appropriate to prevent
connection/session drift.
Return the ID of the sent message.
Optional argument TOOLING Set to t if desiring the tooling session rather than
the standard session."
(with-current-buffer connection
(when-let* ((session (if tooling nrepl-tooling-session nrepl-session)))
(setq request (append request `("session" ,session))))
(let* ((id (nrepl-next-request-id connection))
(request (cons 'dict (cider-plist-put request "id" id)))
(message (nrepl-bencode request)))
(nrepl-log-message request 'request)
(puthash id callback nrepl-pending-requests)
(process-send-string nil message)
id)))