;; Display the buffer and read a choice.
(save-window-excursion
- (pop-to-buffer buf `((display-buffer--maybe-same-window
- display-buffer-reuse-window
- display-buffer--maybe-pop-up-frame-or-window
- display-buffer-at-bottom)
- ,(if temp-buffer-resize-mode
- '(window-height . resize-temp-buffer-window)
- '(window-height . fit-window-to-buffer))
- ,(when temp-buffer-resize-mode
- '(preserve-size . (nil . t)))))
+ (pop-to-buffer buf '(display-buffer--maybe-at-bottom))
(let* ((exit-chars '(?y ?n ?\s ?\C-g ?\C-v))
(prompt (format "Please type %s%s: "
(if offer-save "y, n, or !" "y or n")
(or (not active)
(with-displayed-buffer-window
(get-buffer-create "*Process List*")
- `((display-buffer--maybe-same-window
- display-buffer-reuse-window
- display-buffer--maybe-pop-up-frame-or-window
- display-buffer-at-bottom)
- ,(if temp-buffer-resize-mode
- '(window-height . resize-temp-buffer-window)
- '(window-height . fit-window-to-buffer))
- ,(when temp-buffer-resize-mode
- '(preserve-size . (nil . t))))
+ '(display-buffer--maybe-at-bottom)
#'(lambda (window _value)
(with-selected-window window
(unwind-protect
;; window, mark it as softly-dedicated, so bury-buffer in
;; minibuffer-hide-completions will know whether to
;; delete the window or not.
- (display-buffer-mark-dedicated 'soft)
- ;; Disable `pop-up-windows' temporarily to allow
- ;; `display-buffer--maybe-pop-up-frame-or-window'
- ;; in the display actions below to pop up a frame
- ;; if `pop-up-frames' is non-nil, but not to pop up a window.
- (pop-up-windows nil))
+ (display-buffer-mark-dedicated 'soft))
(with-displayed-buffer-window
"*Completions*"
;; This is a copy of `display-buffer-fallback-action'
;; with `display-buffer-at-bottom'.
`((display-buffer--maybe-same-window
display-buffer-reuse-window
- display-buffer--maybe-pop-up-frame-or-window
+ display-buffer--maybe-pop-up-frame
;; Use `display-buffer-below-selected' for inline completions,
;; but not in the minibuffer (e.g. in `eval-expression')
;; for which `display-buffer-at-bottom' is used.
If that cannot be done, and `pop-up-windows' is non-nil, try
again with `display-buffer-pop-up-window'."
- (or (and (if (eq pop-up-frames 'graphic-only)
- (display-graphic-p)
- pop-up-frames)
- (display-buffer-pop-up-frame buffer alist))
- (and pop-up-windows
- (display-buffer-pop-up-window buffer alist))))
+ (or (display-buffer--maybe-pop-up-frame buffer alist)
+ (display-buffer--maybe-pop-up-window buffer alist)))
+
+(defun display-buffer--maybe-pop-up-frame (buffer alist)
+ "Try displaying BUFFER based on `pop-up-frames'.
+If `pop-up-frames' is non-nil (and not `graphic-only' on a
+text-only terminal), try with `display-buffer-pop-up-frame'."
+ (and (if (eq pop-up-frames 'graphic-only)
+ (display-graphic-p)
+ pop-up-frames)
+ (display-buffer-pop-up-frame buffer alist)))
+
+(defun display-buffer--maybe-pop-up-window (buffer alist)
+ "Try displaying BUFFER based on `pop-up-windows'.
+If `pop-up-windows' is non-nil, try with `display-buffer-pop-up-window'."
+ (and pop-up-windows
+ (display-buffer-pop-up-window buffer alist)))
(defun display-buffer-in-child-frame (buffer alist)
"Display BUFFER in a child frame.
(window--display-buffer
buffer window 'reuse alist display-buffer-mark-dedicated)))))
+(defun display-buffer--maybe-at-bottom (buffer alist)
+ (let ((alist (append alist `(,(if temp-buffer-resize-mode
+ '(window-height . resize-temp-buffer-window)
+ '(window-height . fit-window-to-buffer))
+ ,(when temp-buffer-resize-mode
+ '(preserve-size . (nil . t)))))))
+ (or (display-buffer--maybe-same-window buffer alist)
+ (display-buffer-reuse-window buffer alist)
+ (display-buffer--maybe-pop-up-frame buffer alist)
+ (display-buffer-at-bottom buffer alist))))
+
(defun display-buffer-at-bottom (buffer alist)
"Try displaying BUFFER in a window at the bottom of the selected frame.
This either reuses such a window provided it shows BUFFER
(setq bottom-window-shows-buffer t)
(setq bottom-window window))
((not bottom-window)
- (setq bottom-window window)))
- nil nil 'nomini))
+ (setq bottom-window window))))
+ nil nil 'nomini)
(or (and bottom-window-shows-buffer
(window--display-buffer
buffer bottom-window 'reuse alist display-buffer-mark-dedicated))