Function: cider-repl-init

cider-repl-init is a byte-compiled function defined in cider-repl.el.

Signature

(cider-repl-init BUFFER &optional CALLBACK)

Documentation

Initialize the REPL in BUFFER.

BUFFER must be a REPL buffer with cider-repl-mode and a running client process connection. CALLBACK will be run once the REPL is fully initialized.

Source Code

;; Defined in ~/.emacs.d/elpa/cider-20260414.1619/cider-repl.el
(defun cider-repl-init (buffer &optional callback)
  "Initialize the REPL in BUFFER.
BUFFER must be a REPL buffer with `cider-repl-mode' and a running
client process connection.  CALLBACK will be run once the REPL is
fully initialized."
  (when cider-repl-display-in-current-window
    (add-to-list 'same-window-buffer-names (buffer-name buffer)))
  (pcase cider-repl-pop-to-buffer-on-connect
    (`display-only
     (let ((orig-buffer (current-buffer)))
       (display-buffer buffer)
       ;; User popup-rules (specifically `:select nil') can cause the call to
       ;; `display-buffer' to reset the current Emacs buffer to the clj/cljs
       ;; buffer that the user ran `jack-in' from - we need the current-buffer
       ;; to be the repl to initialize, so reset it back here to be resilient
       ;; against user config
       (set-buffer orig-buffer)))
    ((pred identity) (pop-to-buffer buffer)))
  (with-current-buffer buffer
    (cider-repl--insert-banner)
    (cider-repl--insert-startup-commands)
    (when-let* ((window (get-buffer-window buffer t)))
      (with-selected-window window
        (recenter (- -1 scroll-margin))))
    (cider-repl-eval-init-code callback))
  buffer)