Function: cider-repl-create
cider-repl-create is a byte-compiled function defined in
cider-connection.el.
Signature
(cider-repl-create PARAMS)
Documentation
Create new repl buffer.
PARAMS is a plist which contains :repl-type, :host, :port, :project-dir,
:repl-init-function and :session-name. When non-nil, :repl-init-function
must be a function with no arguments which is called after repl creation
function with the repl buffer set as current.
Source Code
;; Defined in ~/.emacs.d/elpa/cider-20260414.1619/cider-connection.el
(defun cider-repl-create (params)
"Create new repl buffer.
PARAMS is a plist which contains :repl-type, :host, :port, :project-dir,
:repl-init-function and :session-name. When non-nil, :repl-init-function
must be a function with no arguments which is called after repl creation
function with the repl buffer set as current."
;; Connection might not have been set as yet. Please don't send requests in
;; this function, but use cider--connected-handler instead.
(let ((buffer (or (plist-get params :repl-buffer)
(and cider-reuse-dead-repls
(cider--choose-reusable-repl-buffer params))
(get-buffer-create (generate-new-buffer-name "*cider-uninitialized-repl*"))))
(ses-name (or (plist-get params :session-name)
(cider-make-session-name params))))
(with-current-buffer buffer
(setq-local sesman-system 'CIDER)
(setq-local default-directory (or (plist-get params :project-dir) default-directory))
;; creates a new session if session with ses-name doesn't already exist
(sesman-add-object 'CIDER ses-name buffer 'allow-new)
(unless (derived-mode-p 'cider-repl-mode)
(cider-repl-mode))
(setq nrepl-err-handler #'cider-default-err-handler
;; used as a new-repl marker in cider-set-repl-type
mode-name nil
cider-session-name ses-name
nrepl-project-dir (plist-get params :project-dir)
;; Cljs repls are pending until they are upgraded. See cider-repl--state-handler
cider-repl-type (plist-get params :repl-type)
cider-repl-cljs-upgrade-pending (plist-get params :cider-repl-cljs-upgrade-pending)
;; ran at the end of cider--connected-handler
cider-repl-init-function (plist-get params :repl-init-function)
cider-launch-params params)
(when-let ((type (plist-get params :cljs-repl-type)))
(setq cider-cljs-repl-type type))
(cider-repl-reset-markers)
(add-hook 'nrepl-response-handler-functions #'cider-repl--state-handler nil 'local)
(add-hook 'nrepl-connected-hook #'cider--connected-handler nil 'local)
(add-hook 'nrepl-disconnected-hook #'cider--disconnected-handler nil 'local)
(current-buffer))))