Function: display-buffer-pop-up-window

display-buffer-pop-up-window is a byte-compiled function defined in window.el.gz.

Signature

(display-buffer-pop-up-window BUFFER ALIST)

Documentation

Display BUFFER by popping up a new window.

The new window is created on the selected frame, or in last-nonminibuffer-frame if no windows can be created there. If successful, return the new window; otherwise return nil.

ALIST is an association list of action symbols and values. See Info node (elisp) Buffer Display Action Alists for details of such alists.

If ALIST has a non-nil inhibit-switch-frame entry, then in the event that the new window is created on another frame, avoid raising the frame.

This is an action function for buffer display, see Info node (elisp) Buffer Display Action Functions. It should be called only by display-buffer or a function directly or indirectly called by the latter.

View in manual

Source Code

;; Defined in /usr/src/emacs/lisp/window.el.gz
(defun display-buffer-pop-up-window (buffer alist)
  "Display BUFFER by popping up a new window.
The new window is created on the selected frame, or in
`last-nonminibuffer-frame' if no windows can be created there.
If successful, return the new window; otherwise return nil.

ALIST is an association list of action symbols and values.  See
Info node `(elisp) Buffer Display Action Alists' for details of
such alists.

If ALIST has a non-nil `inhibit-switch-frame' entry, then in the
event that the new window is created on another frame, avoid
raising the frame.

This is an action function for buffer display, see Info
node `(elisp) Buffer Display Action Functions'.  It should be
called only by `display-buffer' or a function directly or
indirectly called by the latter."
  (let ((frame (or (window--frame-usable-p (selected-frame))
		   (window--frame-usable-p (last-nonminibuffer-frame))))
	window)
    (when (and (or (not (frame-parameter frame 'unsplittable))
		   ;; If the selected frame cannot be split, look at
		   ;; `last-nonminibuffer-frame'.
		   (and (eq frame (selected-frame))
			(setq frame (last-nonminibuffer-frame))
			(window--frame-usable-p frame)
			(not (frame-parameter frame 'unsplittable))))
	       ;; Attempt to split largest or least recently used window.
	       (setq window (or (window--try-to-split-window
				 (get-largest-window frame t) alist)
				(window--try-to-split-window
				 (get-lru-window frame t) alist))))

      (prog1 (window--display-buffer buffer window 'window alist)
	(unless (cdr (assq 'inhibit-switch-frame alist))
	  (window--maybe-raise-frame (window-frame window)))))))