Subject: bug#17554: 24.3.91; [Regression] re-usage of dired *Marked Files* buffer window

From: Juri Linkov <[email-masked]>
Date: Tue, 17 Jun 2014 09:44:19 +0300

>> We need two temp buffers like *Marked files* (small) and
>> *Completions* (bigger) for this bug to show up.
>
> FWIW, I think the right way to handle this case is to mark the window
> displaying *Marked files* as "dedicated".

This is achieved in this patch by binding `display-buffer-mark-dedicated'
to the same value 'soft' as in `minibuffer-completion-help' used
to display *Completions*.

Also I noticed that everywhere in code only `soft' is used instead of `softly'
that is suggested in window.el, so documentation could be fixed as well.

=== modified file 'lisp/dired.el'
--- lisp/dired.el	2014-05-08 19:22:43 +0000
+++ lisp/dired.el	2014-06-17 06:42:52 +0000
@@ -3099,7 +3099,10 @@ (defun dired-mark-pop-up (buffer-or-name
 	  ;; If FILES defaulted to the current line's file.
 	  (= (length files) 1))
       (apply function args)
-    (let ((buffer (get-buffer-create (or buffer-or-name " *Marked Files*"))))
+    (let ((buffer (get-buffer-create (or buffer-or-name " *Marked Files*")))
+	  ;; Mark *Marked Files* as softly-dedicated, to prevent other
+	  ;; new windows e.g. *Completions* from reusing it (bug#17554).
+	  (display-buffer-mark-dedicated 'soft))
       (with-current-buffer buffer
 	(with-current-buffer-window
 	 buffer

=== modified file 'lisp/window.el'
--- lisp/window.el	2014-06-03 12:38:17 +0000
+++ lisp/window.el	2014-06-17 06:42:19 +0000
@@ -5966,7 +5966,7 @@ (defun window--maybe-raise-frame (frame)
 ;; FIXME: By the way, there could be more levels of dedication:
 ;; - `barely' dedicated doesn't prevent reuse of the window, only records that
 ;;   the window hasn't been used for something else yet.
-;; - `softly' dedicated only allows reuse when asked explicitly.
+;; - `soft' dedicated only allows reuse when asked explicitly.
 ;; - `strongly' never allows reuse.
 (defvar display-buffer-mark-dedicated nil
   "If non-nil, `display-buffer' marks the windows it creates as dedicated.