Function: cider-make-popup-buffer
cider-make-popup-buffer is a byte-compiled function defined in
cider-popup.el.
Signature
(cider-make-popup-buffer NAME &optional MODE ANCILLARY)
Documentation
Create a temporary buffer called NAME using major MODE (if specified).
If ANCILLARY is non-nil, the buffer is added to cider-ancillary-buffers
and automatically removed when killed.
The buffer is pinned to the REPL of the session it is created from (via
cider--pinned-repl-buffer) and adopts that session's project
default-directory, so its evaluations and project-aware commands target
the originating session rather than relying on sesman re-resolution.
Source Code
;; Defined in ~/.emacs.d/elpa/cider-20260822.1520/cider-popup.el
(defun cider-make-popup-buffer (name &optional mode ancillary)
"Create a temporary buffer called NAME using major MODE (if specified).
If ANCILLARY is non-nil, the buffer is added to `cider-ancillary-buffers'
and automatically removed when killed.
The buffer is pinned to the REPL of the session it is created from (via
`cider--pinned-repl-buffer') and adopts that session's project
`default-directory', so its evaluations and project-aware commands target
the originating session rather than relying on sesman re-resolution."
;; Resolve the originating REPL in the *calling* buffer's context (typically
;; the connection buffer, since popups are usually created inside async
;; response handlers). We use it below to pin the popup to the session that
;; produced it and to adopt that session's project directory.
(let ((repl (ignore-errors (cider-current-repl))))
(with-current-buffer (get-buffer-create name)
(kill-all-local-variables)
(setq buffer-read-only nil)
(erase-buffer)
(when mode
(funcall mode))
(cider-popup-buffer-mode 1)
(setq cider-popup-output-marker (point-marker))
(setq buffer-read-only t)
;; Associate the popup with its originating session explicitly, instead of
;; relying on sesman re-resolution from `default-directory'. This pins
;; `cider-current-repl' (see its definition) and makes project-aware
;; commands (project.el, magit) operate on the session's project.
(when (buffer-live-p repl)
(setq-local cider--pinned-repl-buffer repl)
(setq-local default-directory
(buffer-local-value 'default-directory repl)))
(when ancillary
(add-to-list 'cider-ancillary-buffers name)
(add-hook 'kill-buffer-hook
(lambda ()
(setq cider-ancillary-buffers
(remove name cider-ancillary-buffers)))
nil 'local))
(current-buffer))))