Commit d2c9fc42 authored by Stefan Monnier's avatar Stefan Monnier
Browse files

* window.el (display-buffer-mark-dedicated): New var.

(display-buffer): Obey it.
* minibuffer.el (minibuffer-completion-help): Use it.
parent 31a1c477
2009-11-19 Stefan Monnier <monnier@iro.umontreal.ca>
* window.el (display-buffer-mark-dedicated): New var.
(display-buffer): Obey it.
* minibuffer.el (minibuffer-completion-help): Use it.
* progmodes/sym-comp.el (symbol-complete): Use completion-in-region.
* filecache.el (file-cache-add-file): Use push and cons.
......
......@@ -1004,9 +1004,14 @@ variables.")
(if (and completions
(or (consp (cdr completions))
(not (equal (car completions) string))))
(with-output-to-temp-buffer "*Completions*"
(let* ((last (last completions))
(base-size (cdr last)))
(let* ((last (last completions))
(base-size (cdr last))
;; If the *Completions* buffer is shown in a new
;; 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))
(with-output-to-temp-buffer "*Completions*"
;; Remove the base-size tail because `sort' requires a properly
;; nil-terminated list.
(when last (setcdr last nil))
......@@ -1019,11 +1024,11 @@ variables.")
(if ann (list s ann) s)))
completions)))
(with-current-buffer standard-output
(set (make-local-variable 'completion-base-position)
;; FIXME: We should provide the END part as well, but
;; currently completion-all-completions does not give
;; us the necessary information.
(list (+ start base-size) nil)))
(set (make-local-variable 'completion-base-position)
;; FIXME: We should provide the END part as well, but
;; currently completion-all-completions does not give
;; us the necessary information.
(list (+ start base-size) nil)))
(display-completion-list completions)))
;; If there are no completions, or if the current input is already the
......
......@@ -1042,6 +1042,11 @@ Return WINDOW."
(set-window-buffer window buffer)
(window--display-buffer-1 window)))
(defvar display-buffer-mark-dedicated nil
"If non-nil, `display-buffer' marks the windows it creates as dedicated.
The actual non-nil value of this variable will be copied to the
`window-dedicated-p' flag.")
(defun display-buffer (buffer-or-name &optional not-this-window frame)
"Make buffer BUFFER-OR-NAME appear in some window but don't select it.
BUFFER-OR-NAME must be a buffer or the name of an existing
......@@ -1133,8 +1138,10 @@ consider all visible or iconified frames."
buffer (if (listp pars) pars))))))
((or use-pop-up-frames (not frame-to-use))
;; We want or need a new frame.
(window--display-buffer-2
buffer (frame-selected-window (funcall pop-up-frame-function))))
(let ((win (frame-selected-window (funcall pop-up-frame-function))))
(when display-buffer-mark-dedicated
(set-window-dedicated-p win display-buffer-mark-dedicated))
(window--display-buffer-2 buffer win)))
((and pop-up-windows
;; Make a new window.
(or (not (frame-parameter frame-to-use 'unsplittable))
......@@ -1149,8 +1156,10 @@ consider all visible or iconified frames."
(or (window--try-to-split-window
(get-largest-window frame-to-use t))
(window--try-to-split-window
(get-lru-window frame-to-use t))))
(window--display-buffer-2 buffer window-to-use)))
(get-lru-window frame-to-use t)))))
(when display-buffer-mark-dedicated
(set-window-dedicated-p window-to-use display-buffer-mark-dedicated))
(window--display-buffer-2 buffer window-to-use))
((let ((window-to-undedicate
;; When NOT-THIS-WINDOW is non-nil, temporarily dedicate
;; the selected window to its buffer, to avoid that some of
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment