Function: special-display-popup-frame
special-display-popup-frame is a byte-compiled function defined in
window.el.gz.
Signature
(special-display-popup-frame BUFFER &optional ARGS)
Documentation
Pop up a frame displaying BUFFER and return its window.
If BUFFER is already displayed in a visible or iconified frame, raise that frame. Otherwise, display BUFFER in a new frame.
Optional argument ARGS is a list specifying additional information.
If ARGS is an alist, use it as a list of frame parameters. If these parameters contain (same-window . t), display BUFFER in the selected window. If they contain (same-frame . t), display BUFFER in a window of the selected frame.
If ARGS is a list whose car is a symbol, use (car ARGS) as a function to do the work. Pass it BUFFER as first argument, and pass the elements of (cdr ARGS) as the remaining arguments.
Source Code
;; Defined in /usr/src/emacs/lisp/window.el.gz
(defun special-display-popup-frame (buffer &optional args)
"Pop up a frame displaying BUFFER and return its window.
If BUFFER is already displayed in a visible or iconified frame,
raise that frame. Otherwise, display BUFFER in a new frame.
Optional argument ARGS is a list specifying additional
information.
If ARGS is an alist, use it as a list of frame parameters. If
these parameters contain (same-window . t), display BUFFER in
the selected window. If they contain (same-frame . t), display
BUFFER in a window of the selected frame.
If ARGS is a list whose car is a symbol, use (car ARGS) as a
function to do the work. Pass it BUFFER as first argument, and
pass the elements of (cdr ARGS) as the remaining arguments."
(if (and args (symbolp (car args)))
(apply (car args) buffer (cdr args))
(let ((window (get-buffer-window buffer 0)))
(or
;; If we have a window already, make it visible.
(when window
(let ((frame (window-frame window)))
(make-frame-visible frame)
(raise-frame frame)
(display-buffer-record-window 'reuse window buffer)
window))
;; Reuse the current window if the user requested it.
(when (cdr (assq 'same-window args))
(condition-case nil
(progn (switch-to-buffer buffer nil t) (selected-window))
(error nil)))
;; Stay on the same frame if requested.
(when (or (cdr (assq 'same-frame args)) (cdr (assq 'same-window args)))
(let* ((pop-up-windows t)
pop-up-frames
special-display-buffer-names special-display-regexps)
(display-buffer buffer)))
;; If no window yet, make one in a new frame.
(let* ((frame
(with-current-buffer buffer
(make-frame (append args special-display-frame-alist))))
(window (frame-selected-window frame)))
(display-buffer-record-window 'frame window buffer)
(unless (eq buffer (window-buffer window))
(set-window-buffer window buffer)
(set-window-prev-buffers window nil))
(set-window-dedicated-p window t)
window)))))