diff options
author | Juri Linkov <juri@linkov.net> | 2018-02-10 23:55:34 +0200 |
---|---|---|
committer | Juri Linkov <juri@linkov.net> | 2018-02-10 23:55:34 +0200 |
commit | 09465bfa063a62f03ea746685111632a832068b9 (patch) | |
tree | f68f93506634ede11dca28fd8d3c0c8d40e548c5 /lisp | |
parent | aaeb101d899a09e18630466c348041a172cd5d91 (diff) | |
download | emacs-09465bfa063a62f03ea746685111632a832068b9.tar.gz |
* lisp/window.el (display-buffer--maybe-at-bottom): New function (bug#30314).
(display-buffer--maybe-pop-up-frame)
(display-buffer--maybe-pop-up-window): New functions created from
display-buffer--maybe-pop-up-frame-or-window.
(display-buffer--maybe-pop-up-frame-or-window): Call
display-buffer--maybe-pop-up-frame or
display-buffer--maybe-pop-up-window.
(display-buffer-at-bottom): Fix parens.
* lisp/minibuffer.el (minibuffer-completion-help): Use
display-buffer--maybe-pop-up-frame instead of let-binding
pop-up-windows to nil.
* lisp/files.el (hack-local-variables-confirm)
(save-buffers-kill-emacs): Use display-buffer--maybe-at-bottom.
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/files.el | 20 | ||||
-rw-r--r-- | lisp/minibuffer.el | 9 | ||||
-rw-r--r-- | lisp/window.el | 38 |
3 files changed, 34 insertions, 33 deletions
diff --git a/lisp/files.el b/lisp/files.el index 414eb3f93af..4b67b02c386 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -3315,15 +3315,7 @@ n -- to ignore the local variables list.") ;; 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") @@ -6929,15 +6921,7 @@ if any returns nil. If `confirm-kill-emacs' is non-nil, calls it." (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 diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index ef0d40790c5..e3ae2912a86 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -1824,12 +1824,7 @@ variables.") ;; 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' @@ -1837,7 +1832,7 @@ variables.") ;; 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. diff --git a/lisp/window.el b/lisp/window.el index abd1a68b1f0..8c5e441e4b6 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -7289,12 +7289,23 @@ text-only terminal), try with `display-buffer-pop-up-frame'. 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. @@ -7360,6 +7371,17 @@ below the selected one, use that window." (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 @@ -7376,8 +7398,8 @@ selected frame." (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)) |