diff options
| author | Juri Linkov | 2018-02-10 23:55:34 +0200 |
|---|---|---|
| committer | Juri Linkov | 2018-02-10 23:55:34 +0200 |
| commit | 09465bfa063a62f03ea746685111632a832068b9 (patch) | |
| tree | f68f93506634ede11dca28fd8d3c0c8d40e548c5 | |
| parent | aaeb101d899a09e18630466c348041a172cd5d91 (diff) | |
| download | emacs-09465bfa063a62f03ea746685111632a832068b9.tar.gz emacs-09465bfa063a62f03ea746685111632a832068b9.zip | |
* 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.
| -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.") | |||
| 3315 | 3315 | ||
| 3316 | ;; Display the buffer and read a choice. | 3316 | ;; Display the buffer and read a choice. |
| 3317 | (save-window-excursion | 3317 | (save-window-excursion |
| 3318 | (pop-to-buffer buf `((display-buffer--maybe-same-window | 3318 | (pop-to-buffer buf '(display-buffer--maybe-at-bottom)) |
| 3319 | display-buffer-reuse-window | ||
| 3320 | display-buffer--maybe-pop-up-frame-or-window | ||
| 3321 | display-buffer-at-bottom) | ||
| 3322 | ,(if temp-buffer-resize-mode | ||
| 3323 | '(window-height . resize-temp-buffer-window) | ||
| 3324 | '(window-height . fit-window-to-buffer)) | ||
| 3325 | ,(when temp-buffer-resize-mode | ||
| 3326 | '(preserve-size . (nil . t))))) | ||
| 3327 | (let* ((exit-chars '(?y ?n ?\s ?\C-g ?\C-v)) | 3319 | (let* ((exit-chars '(?y ?n ?\s ?\C-g ?\C-v)) |
| 3328 | (prompt (format "Please type %s%s: " | 3320 | (prompt (format "Please type %s%s: " |
| 3329 | (if offer-save "y, n, or !" "y or n") | 3321 | (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." | |||
| 6929 | (or (not active) | 6921 | (or (not active) |
| 6930 | (with-displayed-buffer-window | 6922 | (with-displayed-buffer-window |
| 6931 | (get-buffer-create "*Process List*") | 6923 | (get-buffer-create "*Process List*") |
| 6932 | `((display-buffer--maybe-same-window | 6924 | '(display-buffer--maybe-at-bottom) |
| 6933 | display-buffer-reuse-window | ||
| 6934 | display-buffer--maybe-pop-up-frame-or-window | ||
| 6935 | display-buffer-at-bottom) | ||
| 6936 | ,(if temp-buffer-resize-mode | ||
| 6937 | '(window-height . resize-temp-buffer-window) | ||
| 6938 | '(window-height . fit-window-to-buffer)) | ||
| 6939 | ,(when temp-buffer-resize-mode | ||
| 6940 | '(preserve-size . (nil . t)))) | ||
| 6941 | #'(lambda (window _value) | 6925 | #'(lambda (window _value) |
| 6942 | (with-selected-window window | 6926 | (with-selected-window window |
| 6943 | (unwind-protect | 6927 | (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.") | |||
| 1824 | ;; window, mark it as softly-dedicated, so bury-buffer in | 1824 | ;; window, mark it as softly-dedicated, so bury-buffer in |
| 1825 | ;; minibuffer-hide-completions will know whether to | 1825 | ;; minibuffer-hide-completions will know whether to |
| 1826 | ;; delete the window or not. | 1826 | ;; delete the window or not. |
| 1827 | (display-buffer-mark-dedicated 'soft) | 1827 | (display-buffer-mark-dedicated 'soft)) |
| 1828 | ;; Disable `pop-up-windows' temporarily to allow | ||
| 1829 | ;; `display-buffer--maybe-pop-up-frame-or-window' | ||
| 1830 | ;; in the display actions below to pop up a frame | ||
| 1831 | ;; if `pop-up-frames' is non-nil, but not to pop up a window. | ||
| 1832 | (pop-up-windows nil)) | ||
| 1833 | (with-displayed-buffer-window | 1828 | (with-displayed-buffer-window |
| 1834 | "*Completions*" | 1829 | "*Completions*" |
| 1835 | ;; This is a copy of `display-buffer-fallback-action' | 1830 | ;; This is a copy of `display-buffer-fallback-action' |
| @@ -1837,7 +1832,7 @@ variables.") | |||
| 1837 | ;; with `display-buffer-at-bottom'. | 1832 | ;; with `display-buffer-at-bottom'. |
| 1838 | `((display-buffer--maybe-same-window | 1833 | `((display-buffer--maybe-same-window |
| 1839 | display-buffer-reuse-window | 1834 | display-buffer-reuse-window |
| 1840 | display-buffer--maybe-pop-up-frame-or-window | 1835 | display-buffer--maybe-pop-up-frame |
| 1841 | ;; Use `display-buffer-below-selected' for inline completions, | 1836 | ;; Use `display-buffer-below-selected' for inline completions, |
| 1842 | ;; but not in the minibuffer (e.g. in `eval-expression') | 1837 | ;; but not in the minibuffer (e.g. in `eval-expression') |
| 1843 | ;; for which `display-buffer-at-bottom' is used. | 1838 | ;; 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'. | |||
| 7289 | 7289 | ||
| 7290 | If that cannot be done, and `pop-up-windows' is non-nil, try | 7290 | If that cannot be done, and `pop-up-windows' is non-nil, try |
| 7291 | again with `display-buffer-pop-up-window'." | 7291 | again with `display-buffer-pop-up-window'." |
| 7292 | (or (and (if (eq pop-up-frames 'graphic-only) | 7292 | (or (display-buffer--maybe-pop-up-frame buffer alist) |
| 7293 | (display-graphic-p) | 7293 | (display-buffer--maybe-pop-up-window buffer alist))) |
| 7294 | pop-up-frames) | 7294 | |
| 7295 | (display-buffer-pop-up-frame buffer alist)) | 7295 | (defun display-buffer--maybe-pop-up-frame (buffer alist) |
| 7296 | (and pop-up-windows | 7296 | "Try displaying BUFFER based on `pop-up-frames'. |
| 7297 | (display-buffer-pop-up-window buffer alist)))) | 7297 | If `pop-up-frames' is non-nil (and not `graphic-only' on a |
| 7298 | text-only terminal), try with `display-buffer-pop-up-frame'." | ||
| 7299 | (and (if (eq pop-up-frames 'graphic-only) | ||
| 7300 | (display-graphic-p) | ||
| 7301 | pop-up-frames) | ||
| 7302 | (display-buffer-pop-up-frame buffer alist))) | ||
| 7303 | |||
| 7304 | (defun display-buffer--maybe-pop-up-window (buffer alist) | ||
| 7305 | "Try displaying BUFFER based on `pop-up-windows'. | ||
| 7306 | If `pop-up-windows' is non-nil, try with `display-buffer-pop-up-window'." | ||
| 7307 | (and pop-up-windows | ||
| 7308 | (display-buffer-pop-up-window buffer alist))) | ||
| 7298 | 7309 | ||
| 7299 | (defun display-buffer-in-child-frame (buffer alist) | 7310 | (defun display-buffer-in-child-frame (buffer alist) |
| 7300 | "Display BUFFER in a child frame. | 7311 | "Display BUFFER in a child frame. |
| @@ -7360,6 +7371,17 @@ below the selected one, use that window." | |||
| 7360 | (window--display-buffer | 7371 | (window--display-buffer |
| 7361 | buffer window 'reuse alist display-buffer-mark-dedicated))))) | 7372 | buffer window 'reuse alist display-buffer-mark-dedicated))))) |
| 7362 | 7373 | ||
| 7374 | (defun display-buffer--maybe-at-bottom (buffer alist) | ||
| 7375 | (let ((alist (append alist `(,(if temp-buffer-resize-mode | ||
| 7376 | '(window-height . resize-temp-buffer-window) | ||
| 7377 | '(window-height . fit-window-to-buffer)) | ||
| 7378 | ,(when temp-buffer-resize-mode | ||
| 7379 | '(preserve-size . (nil . t))))))) | ||
| 7380 | (or (display-buffer--maybe-same-window buffer alist) | ||
| 7381 | (display-buffer-reuse-window buffer alist) | ||
| 7382 | (display-buffer--maybe-pop-up-frame buffer alist) | ||
| 7383 | (display-buffer-at-bottom buffer alist)))) | ||
| 7384 | |||
| 7363 | (defun display-buffer-at-bottom (buffer alist) | 7385 | (defun display-buffer-at-bottom (buffer alist) |
| 7364 | "Try displaying BUFFER in a window at the bottom of the selected frame. | 7386 | "Try displaying BUFFER in a window at the bottom of the selected frame. |
| 7365 | This either reuses such a window provided it shows BUFFER | 7387 | This either reuses such a window provided it shows BUFFER |
| @@ -7376,8 +7398,8 @@ selected frame." | |||
| 7376 | (setq bottom-window-shows-buffer t) | 7398 | (setq bottom-window-shows-buffer t) |
| 7377 | (setq bottom-window window)) | 7399 | (setq bottom-window window)) |
| 7378 | ((not bottom-window) | 7400 | ((not bottom-window) |
| 7379 | (setq bottom-window window))) | 7401 | (setq bottom-window window)))) |
| 7380 | nil nil 'nomini)) | 7402 | nil nil 'nomini) |
| 7381 | (or (and bottom-window-shows-buffer | 7403 | (or (and bottom-window-shows-buffer |
| 7382 | (window--display-buffer | 7404 | (window--display-buffer |
| 7383 | buffer bottom-window 'reuse alist display-buffer-mark-dedicated)) | 7405 | buffer bottom-window 'reuse alist display-buffer-mark-dedicated)) |