Function: cider-repls
cider-repls is a byte-compiled function defined in cider-session.el.
Signature
(cider-repls &optional TYPE ENSURE REQUIRED-OPS)
Documentation
Return cider REPLs of TYPE from the current session.
If TYPE is nil or multi, return all REPLs. If TYPE is a list of types, return only REPLs of type contained in the list. If ENSURE is non-nil, throw an error if no linked session exists. If REQUIRED-OPS is non-nil, filters out all the REPLs that do not support the designated ops.
If the buffer is pinned to a REPL via cider--pinned-repl-buffer, that
REPL's session is used instead of the current one (taking precedence over
cider-default-session); a stale pin falls through to normal resolution.
Aliases
cider-connections (obsolete since 2.0.0)
Source Code
;; Defined in ~/.emacs.d/elpa/cider-20260822.1520/cider-session.el
(defun cider-repls (&optional type ensure required-ops)
"Return cider REPLs of TYPE from the current session.
If TYPE is nil or multi, return all REPLs. If TYPE is a list of types,
return only REPLs of type contained in the list. If ENSURE is non-nil,
throw an error if no linked session exists. If REQUIRED-OPS is non-nil,
filters out all the REPLs that do not support the designated ops.
If the buffer is pinned to a REPL via `cider--pinned-repl-buffer', that
REPL's session is used instead of the current one (taking precedence over
`cider-default-session'); a stale pin falls through to normal resolution."
(let* ((type (cond
((listp type)
(mapcar #'cider-maybe-intern type))
((cider-maybe-intern type))))
;; Gather the candidate REPLs for the current buffer. Each branch
;; produces the raw list without an `ensure' check; the single check
;; below reports the absence of any linked session uniformly.
;; A buffer explicitly pinned to a REPL (e.g. a popup created from a
;; given session) resolves against that REPL's *session*, independent
;; of sesman/`default-directory'. We resolve the session - not just the
;; lone REPL - so type filtering and multi (clj+cljs) dispatch keep
;; working. Takes precedence over `cider-default-session', matching
;; `cider-current-repl', which checks the pin first.
(pinned-session (cider--pinned-session))
(repls (cond
(pinned-session (cdr pinned-session))
;; A pinned default session bypasses sesman entirely and serves
;; every buffer. If it has been quit since being pinned, warn
;; and treat it as having no REPLs, so the `ensure' check below
;; reports the missing session.
(cider-default-session
(if-let* ((session (cider--default-session)))
(cdr session)
(message "Default CIDER session '%s' no longer exists, ignoring" cider-default-session)
nil))
(t
(pcase cider-merge-sessions
;; Merge every linked session sharing the current session's
;; host into one pool of REPLs.
('host (cider--extract-connections
(cider--get-sessions-with-same-host
(sesman-current-session 'CIDER)
(sesman-current-sessions 'CIDER))))
;; Merge all sessions linked to the current project.
('project (cider--extract-connections (sesman-current-sessions 'CIDER)))
;; No merging: use only the most relevant linked session.
(_ (cdr (sesman-current-session 'CIDER))))))))
;; `ensure' has two distinct failure modes: no linked session at all
;; (reported here, matching `sesman-ensure-session') and a session that
;; has no REPL of the requested TYPE (reported after filtering below).
(when (and ensure (null repls))
(user-error "No linked %s sessions" 'CIDER))
(or (seq-filter (lambda (b)
(unless
(cider-cljs-pending-p b)
(and (cider--match-repl-type type b)
(seq-every-p (lambda (op)
(cider-nrepl-op-supported-p op b))
required-ops))))
repls)
(when ensure
(cider--no-repls-user-error type)))))