Mercurial > emacs
comparison lisp/window.el @ 106238:8cb41d65f821
Really make the *Completions* window soft-dedicated (bug#5030).
* window.el (window--display-buffer-2): Add `dedicated' argument.
(display-buffer): Pass it when needed so the dedicated flag is set
after calling set-window-buffer, which would otherwise reset it.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Wed, 25 Nov 2009 16:36:04 +0000 |
parents | 34a3dd721f80 |
children | f4a3f47777f7 |
comparison
equal
deleted
inserted
replaced
106237:7ddab4671153 | 106238:8cb41d65f821 |
---|---|
1033 (and (minibuffer-window-active-p (selected-window)) | 1033 (and (minibuffer-window-active-p (selected-window)) |
1034 (eq frame (window-frame (minibuffer-selected-window))))) | 1034 (eq frame (window-frame (minibuffer-selected-window))))) |
1035 (raise-frame frame)) | 1035 (raise-frame frame)) |
1036 window)) | 1036 window)) |
1037 | 1037 |
1038 (defun window--display-buffer-2 (buffer window) | 1038 (defun window--display-buffer-2 (buffer window &optional dedicated) |
1039 "Display BUFFER in WINDOW and make its frame visible. | 1039 "Display BUFFER in WINDOW and make its frame visible. |
1040 Set `window-dedicated-p' to DEDICATED if non-nil. | |
1040 Return WINDOW." | 1041 Return WINDOW." |
1041 (when (and (buffer-live-p buffer) (window-live-p window)) | 1042 (when (and (buffer-live-p buffer) (window-live-p window)) |
1042 (set-window-buffer window buffer) | 1043 (set-window-buffer window buffer) |
1044 (when dedicated | |
1045 (set-window-dedicated-p window-to-use dedicated)) | |
1043 (window--display-buffer-1 window))) | 1046 (window--display-buffer-1 window))) |
1044 | 1047 |
1045 (defvar display-buffer-mark-dedicated nil | 1048 (defvar display-buffer-mark-dedicated nil |
1046 "If non-nil, `display-buffer' marks the windows it creates as dedicated. | 1049 "If non-nil, `display-buffer' marks the windows it creates as dedicated. |
1047 The actual non-nil value of this variable will be copied to the | 1050 The actual non-nil value of this variable will be copied to the |
1137 (funcall special-display-function | 1140 (funcall special-display-function |
1138 buffer (if (listp pars) pars)))))) | 1141 buffer (if (listp pars) pars)))))) |
1139 ((or use-pop-up-frames (not frame-to-use)) | 1142 ((or use-pop-up-frames (not frame-to-use)) |
1140 ;; We want or need a new frame. | 1143 ;; We want or need a new frame. |
1141 (let ((win (frame-selected-window (funcall pop-up-frame-function)))) | 1144 (let ((win (frame-selected-window (funcall pop-up-frame-function)))) |
1142 (when display-buffer-mark-dedicated | 1145 (window--display-buffer-2 buffer win display-buffer-mark-dedicated))) |
1143 (set-window-dedicated-p win display-buffer-mark-dedicated)) | |
1144 (window--display-buffer-2 buffer win))) | |
1145 ((and pop-up-windows | 1146 ((and pop-up-windows |
1146 ;; Make a new window. | 1147 ;; Make a new window. |
1147 (or (not (frame-parameter frame-to-use 'unsplittable)) | 1148 (or (not (frame-parameter frame-to-use 'unsplittable)) |
1148 ;; If the selected frame cannot be split look at | 1149 ;; If the selected frame cannot be split look at |
1149 ;; `last-nonminibuffer-frame'. | 1150 ;; `last-nonminibuffer-frame'. |
1155 (setq window-to-use | 1156 (setq window-to-use |
1156 (or (window--try-to-split-window | 1157 (or (window--try-to-split-window |
1157 (get-largest-window frame-to-use t)) | 1158 (get-largest-window frame-to-use t)) |
1158 (window--try-to-split-window | 1159 (window--try-to-split-window |
1159 (get-lru-window frame-to-use t))))) | 1160 (get-lru-window frame-to-use t))))) |
1160 (when display-buffer-mark-dedicated | 1161 (window--display-buffer-2 buffer window-to-use |
1161 (set-window-dedicated-p window-to-use display-buffer-mark-dedicated)) | 1162 display-buffer-mark-dedicated)) |
1162 (window--display-buffer-2 buffer window-to-use)) | |
1163 ((let ((window-to-undedicate | 1163 ((let ((window-to-undedicate |
1164 ;; When NOT-THIS-WINDOW is non-nil, temporarily dedicate | 1164 ;; When NOT-THIS-WINDOW is non-nil, temporarily dedicate |
1165 ;; the selected window to its buffer, to avoid that some of | 1165 ;; the selected window to its buffer, to avoid that some of |
1166 ;; the `get-' routines below choose it. (Bug#1415) | 1166 ;; the `get-' routines below choose it. (Bug#1415) |
1167 (and not-this-window (not (window-dedicated-p)) | 1167 (and not-this-window (not (window-dedicated-p)) |