]> git.eshelyaron.com Git - emacs.git/commitdiff
* window.el (display-buffer-mark-dedicated): New var.
authorStefan Monnier <monnier@iro.umontreal.ca>
Thu, 19 Nov 2009 22:05:40 +0000 (22:05 +0000)
committerStefan Monnier <monnier@iro.umontreal.ca>
Thu, 19 Nov 2009 22:05:40 +0000 (22:05 +0000)
(display-buffer): Obey it.
* minibuffer.el (minibuffer-completion-help): Use it.

lisp/ChangeLog
lisp/minibuffer.el
lisp/window.el

index 67bc8e91431ece01a382cad156aa0d451118060a..f14e545a5def04cdb2eb48a592e824ac95f3d968 100644 (file)
@@ -1,5 +1,9 @@
 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.
index 472fd95ece20f1cb597e409e88b5365c3cbaa015..fdf57f9a2f8e1b2a5d4ffc73fe6754a333edfc05 100644 (file)
@@ -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
index 857d3719c5f35813ca5bd26ee342392b8304bfb7..6d32e42ef1dba0cc3349f7e54be1511631d22d50 100644 (file)
@@ -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