Function: nrepl--init-client-sessions
nrepl--init-client-sessions is a byte-compiled function defined in
nrepl-client.el.
Signature
(nrepl--init-client-sessions CLIENT)
Documentation
Initialize CLIENT connection nREPL sessions.
We create two client nREPL sessions per connection - a main session and a tooling session. The main session is general purpose and is used for pretty much every request that needs a session. The tooling session is used only for functionality that's implemented in terms of the "eval" op, so that eval requests for functionality like pretty-printing won't clobber the values of *1, *2, etc.
Source Code
;; Defined in ~/.emacs.d/elpa/cider-20260414.1619/nrepl-client.el
(defun nrepl--init-client-sessions (client)
"Initialize CLIENT connection nREPL sessions.
We create two client nREPL sessions per connection - a main session and a
tooling session. The main session is general purpose and is used for pretty
much every request that needs a session. The tooling session is used only
for functionality that's implemented in terms of the \"eval\" op, so that
eval requests for functionality like pretty-printing won't clobber the
values of *1, *2, etc."
(let* ((client-conn (process-buffer client))
(response-main (nrepl-sync-request:clone client-conn))
(response-tooling (nrepl-sync-request:clone client-conn t))) ; t for tooling
(nrepl-dbind-response response-main (new-session err)
(if new-session
(with-current-buffer client-conn
(setq nrepl-session new-session))
(error "Could not create new session (%s)" err)))
(nrepl-dbind-response response-tooling (new-session err)
(if new-session
(with-current-buffer client-conn
(setq nrepl-tooling-session new-session))
(error "Could not create new tooling session (%s)" err)))))