Function: cider-popup-buffer-display

cider-popup-buffer-display is a byte-compiled function defined in cider-popup.el.

Signature

(cider-popup-buffer-display BUFFER-NAME &optional SELECT)

Documentation

Display the buffer identified by BUFFER-NAME.

If SELECT is non-nil, select the buffer.

You can customize how the window will be chosen/created by adding BUFFER-NAME to the special-display-buffer-names list.

Source Code

;; Defined in ~/.emacs.d/elpa/cider-20260414.1619/cider-popup.el
(defun cider-popup-buffer-display (buffer-name &optional select)
  "Display the buffer identified by BUFFER-NAME.
If SELECT is non-nil, select the buffer.

You can customize how the window will be chosen/created
by adding BUFFER-NAME to the `special-display-buffer-names' list."
  (let ((buffer-name (if (bufferp buffer-name) ;; ensure buffer-name is a string
                         (buffer-name buffer-name)
                       buffer-name)))
    ;; if `buffer-name' belongs to `special-display-buffer-names',
    ;; delegate to that mechanism the displaying of the buffer,
    ;; otherwise the displaying would happen twice (ance through `special-display-buffer-names',
    ;; another time through `cider-popup-buffer-display'):
    (if (and (boundp 'special-display-buffer-names)
             (seq-find (lambda (entry)
                         ;; entry can be either a list or a string
                         (equal (if (listp entry) (car entry) entry) buffer-name))
                       special-display-buffer-names))
        (progn
          (display-buffer buffer-name)
          (when select
            (when-let ((window (get-buffer-window buffer-name)))
              (select-window window))))
      (let ((window (get-buffer-window buffer-name 'visible)))
        (when window
          (with-current-buffer buffer-name
            (set-window-point window (point))))
        ;; If the buffer we are popping up is already displayed in the selected
        ;; window, the below `inhibit-same-window' logic will cause it to be
        ;; displayed twice - so we early out in this case. Note that we must check
        ;; `selected-window', as async request handlers are executed in the context
        ;; of the current connection buffer (i.e. `current-buffer' is dynamically
        ;; bound to that).
        (unless (eq window (selected-window))
          ;; Non nil `inhibit-same-window' ensures that current window is not covered
          ;; Non nil `inhibit-switch-frame' ensures that the other frame is not selected
          ;; if that's where the buffer is being shown.
          (funcall (if select #'pop-to-buffer #'display-buffer)
                   buffer-name `(nil . ((inhibit-same-window .
                                                             ;; A non-nil value prevents the same window from being used for display:
                                                             ,pop-up-windows)
                                        (reusable-frames .
                                                         ;; choose any visible frame
                                                         visible)))))))
    (get-buffer buffer-name)))