GNU bug report logs - #17554
24.3.91; [Regression] re-usage of dired *Marked Files* buffer window

Previous Next

Package: emacs;

Reported by: "Roland Winkler" <winkler <at> gnu.org>

Date: Thu, 22 May 2014 20:01:02 UTC

Severity: normal

Found in version 24.3.91

Done: Juri Linkov <juri <at> jurta.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 17554 in the body.
You can then email your comments to 17554 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#17554; Package emacs. (Thu, 22 May 2014 20:01:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to "Roland Winkler" <winkler <at> gnu.org>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 22 May 2014 20:01:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: "Roland Winkler" <winkler <at> gnu.org>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.3.91; [Regression] re-usage of dired *Marked Files* buffer window
Date: Thu, 22 May 2014 14:59:33 -0500
emacs -Q

open a dired buffer

mark two files

type R to move these files to some other directory

emacs displays a buffer *Marked Files* listing the files to be moved
(with two files to be moved the window displaying this buffer has
three lines)

use TAB completion to find the directory where you want to move
these files

emacs re-uses the three-line window from the *Marked Files* buffer
in order to display the *Completions* buffer.  As the first
completion appears in the 4th line of the *Completions* buffer, a
3-line window is rather ineffective

I guess, quite generally emacs should make sure that the
*Completions* buffer uses a "sufficiently large" window to serve its
purpose.



In GNU Emacs 24.3.91.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.4.2)
 of 2014-05-12 on lukas
Windowing system distributor `The X.Org Foundation', version 11.0.10706000
System Description:	Ubuntu 12.04.4 LTS

Important settings:
  value of $LC_COLLATE: C
  value of $LANG: en_US.ISO-8859-15
  locale-coding-system: iso-latin-9-unix

Major mode: Dired by name




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17554; Package emacs. (Fri, 23 May 2014 01:08:01 GMT) Full text and rfc822 format available.

Message #8 received at 17554 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: "Roland Winkler" <winkler <at> gnu.org>
Cc: 17554 <at> debbugs.gnu.org
Subject: Re: bug#17554: 24.3.91;
 [Regression] re-usage of dired *Marked Files* buffer window
Date: Thu, 22 May 2014 21:07:00 -0400
> emacs re-uses the three-line window from the *Marked Files* buffer
> in order to display the *Completions* buffer.  As the first
> completion appears in the 4th line of the *Completions* buffer, a
> 3-line window is rather ineffective

Your subject says it's a regression: which previous version of Emacs do
you know did not suffer from this problem?


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17554; Package emacs. (Fri, 23 May 2014 02:18:01 GMT) Full text and rfc822 format available.

Message #11 received at 17554 <at> debbugs.gnu.org (full text, mbox):

From: "Roland Winkler" <winkler <at> gnu.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 17554 <at> debbugs.gnu.org
Subject: Re: bug#17554: 24.3.91;
 [Regression] re-usage of dired *Marked Files* buffer window
Date: Thu, 22 May 2014 21:17:27 -0500
On Thu May 22 2014 Stefan Monnier wrote:
> Your subject says it's a regression: which previous version of Emacs do
> you know did not suffer from this problem?

Emacs 24.3 does not give me this problem (I just double-checked):

First it gives me the *Marked Files* window by splitting the main
window (only two lines high if I want to move only two files,
whereas 24.3.91 makes it three lines high).

Then it splits once more the main window for the *Completions*
buffer.  So I get a *Completions* window which is typically large
enough to display the complete *Completions* buffer.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17554; Package emacs. (Fri, 23 May 2014 05:49:02 GMT) Full text and rfc822 format available.

Message #14 received at 17554 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Roland Winkler <winkler <at> gnu.org>
Cc: 17554 <at> debbugs.gnu.org
Subject: Re: bug#17554: 24.3.91;
 [Regression] re-usage of dired *Marked Files* buffer window
Date: Fri, 23 May 2014 08:48:17 +0300
> Date: Thu, 22 May 2014 14:59:33 -0500
> From: "Roland Winkler" <winkler <at> gnu.org>
> 
> I guess, quite generally emacs should make sure that the
> *Completions* buffer uses a "sufficiently large" window to serve its
> purpose.

Emacs has never done that: if completions are displayed in an existing
window, Emacs would always reuse the size, and not resize it.

This is not a regression.

If you don't like what you see, I'm sure Martin will be able to tell
you how to customize the window creation such that it suits your
wishes.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17554; Package emacs. (Fri, 23 May 2014 06:07:02 GMT) Full text and rfc822 format available.

Message #17 received at 17554 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Roland Winkler <winkler <at> gnu.org>
Cc: 17554 <at> debbugs.gnu.org, monnier <at> iro.umontreal.ca
Subject: Re: bug#17554: 24.3.91;
 [Regression] re-usage of dired *Marked Files* buffer window
Date: Fri, 23 May 2014 09:06:48 +0300
> Date: Thu, 22 May 2014 21:17:27 -0500
> From: "Roland Winkler" <winkler <at> gnu.org>
> Cc: 17554 <at> debbugs.gnu.org
> 
> Then it splits once more the main window for the *Completions*
> buffer.  So I get a *Completions* window which is typically large
> enough to display the complete *Completions* buffer.

That's a side effect of popping a new window.  Current Emacs reuses
the same window, so it doesn't resize.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17554; Package emacs. (Fri, 23 May 2014 07:25:02 GMT) Full text and rfc822 format available.

Message #20 received at 17554 <at> debbugs.gnu.org (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: Roland Winkler <winkler <at> gnu.org>, 
 Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: Juri Linkov <juri <at> jurta.org>, 17554 <at> debbugs.gnu.org
Subject: Re: bug#17554: 24.3.91; [Regression] re-usage of dired *Marked Files*
 buffer window
Date: Fri, 23 May 2014 09:24:23 +0200
> Emacs 24.3 does not give me this problem (I just double-checked):

IIUC we now use `display-buffer' for displaying the list of marked files
and completions and both seem to backfire in the present case.

> First it gives me the *Marked Files* window by splitting the main
> window (only two lines high if I want to move only two files,
> whereas 24.3.91 makes it three lines high).

A regression.  It happens because `display-buffer-pop-up-window' obeys
`window-min-height' which is 4, by default.  Subtracting one for the
mode-line gives three lines.  If you mark at least three files you won't
see it.  We could add a `window-height' alist entry to fix this.  Juri -
any ideas where?  My knowledge of `dired' is about zero so I don't want
to add any such switch without some advice.

> Then it splits once more the main window for the *Completions*
> buffer.  So I get a *Completions* window which is typically large
> enough to display the complete *Completions* buffer.

Which is much better indeed.  You can customize `split-height-threshold'
to get three windows again - the *Completions* buffer then appears at the
bottom when the question is asked.  But the default would really look
better with three windows.  Juri - any ideas?

martin




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17554; Package emacs. (Fri, 23 May 2014 07:26:02 GMT) Full text and rfc822 format available.

Message #23 received at 17554 <at> debbugs.gnu.org (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: Eli Zaretskii <eliz <at> gnu.org>, Roland Winkler <winkler <at> gnu.org>
Cc: 17554 <at> debbugs.gnu.org
Subject: Re: bug#17554: 24.3.91; [Regression] re-usage of dired *Marked Files*
 buffer window
Date: Fri, 23 May 2014 09:25:06 +0200
>> I guess, quite generally emacs should make sure that the
>> *Completions* buffer uses a "sufficiently large" window to serve its
>> purpose.
>
> Emacs has never done that: if completions are displayed in an existing
> window, Emacs would always reuse the size, and not resize it.
>
> This is not a regression.

The behavior is worse in this particular case because we reuse an
existing window.  So the default behavior has worsened.

> If you don't like what you see, I'm sure Martin will be able to tell
> you how to customize the window creation such that it suits your
> wishes.

We should try to improve the default behavior.  The points Roland made
are valid, unfortunately.

martin




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17554; Package emacs. (Fri, 23 May 2014 07:32:02 GMT) Full text and rfc822 format available.

Message #26 received at 17554 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: martin rudalics <rudalics <at> gmx.at>
Cc: 17554 <at> debbugs.gnu.org, winkler <at> gnu.org
Subject: Re: bug#17554: 24.3.91;
 [Regression] re-usage of dired *Marked Files* buffer window
Date: Fri, 23 May 2014 10:31:15 +0300
> Date: Fri, 23 May 2014 09:25:06 +0200
> From: martin rudalics <rudalics <at> gmx.at>
> CC: 17554 <at> debbugs.gnu.org
> 
> We should try to improve the default behavior.  The points Roland made
> are valid, unfortunately.

I didn't say there weren't, I'm just saying it's not a regression.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17554; Package emacs. (Fri, 23 May 2014 21:37:02 GMT) Full text and rfc822 format available.

Message #29 received at 17554 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> jurta.org>
To: martin rudalics <rudalics <at> gmx.at>
Cc: 17554 <at> debbugs.gnu.org, Roland Winkler <winkler <at> gnu.org>,
 Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#17554: 24.3.91;
 [Regression] re-usage of dired *Marked Files* buffer window
Date: Sat, 24 May 2014 00:32:28 +0300
>> Then it splits once more the main window for the *Completions*
>> buffer.  So I get a *Completions* window which is typically large
>> enough to display the complete *Completions* buffer.
>
> Which is much better indeed.  You can customize `split-height-threshold'
> to get three windows again - the *Completions* buffer then appears at the
> bottom when the question is asked.  But the default would really look
> better with three windows.  Juri - any ideas?

When the frame is wide enough, then the *Completions* buffer appears
in the side window at the full height of the frame that is nice.

When the frame is narrow then maybe we should use the same positioning
of the *Completions* buffer as was in 23.1? I.e. to show *Completions*
in the window of the original Dired buffer.

But it seems this problem is not specific to Dired.  Creating manually
a window configuration with a small window at the bottom (`C-x 2' and then
`C-x ^' several times), typing `C-x d TAB TAB' displays *Completions*
in the small window.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17554; Package emacs. (Tue, 27 May 2014 21:59:01 GMT) Full text and rfc822 format available.

Message #32 received at 17554 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> jurta.org>
To: martin rudalics <rudalics <at> gmx.at>
Cc: 17554 <at> debbugs.gnu.org, Roland Winkler <winkler <at> gnu.org>
Subject: Re: bug#17554: 24.3.91;
 [Regression] re-usage of dired *Marked Files* buffer window
Date: Wed, 28 May 2014 00:54:54 +0300
>> Which is much better indeed.  You can customize `split-height-threshold'
>> to get three windows again - the *Completions* buffer then appears at the
>> bottom when the question is asked.  But the default would really look
>> better with three windows.  Juri - any ideas?
>
> But it seems this problem is not specific to Dired.  Creating manually
> a window configuration with a small window at the bottom (`C-x 2' and then
> `C-x ^' several times), typing `C-x d TAB TAB' displays *Completions*
> in the small window.

A good placement of the *Completions* buffer can be achieved by using:

(add-to-list 'display-buffer-alist '("\\*Completions\\*" display-buffer-at-bottom (nil)))

It works in Dired as well with different window configurations.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17554; Package emacs. (Tue, 27 May 2014 22:47:02 GMT) Full text and rfc822 format available.

Message #35 received at 17554 <at> debbugs.gnu.org (full text, mbox):

From: "Roland Winkler" <winkler <at> gnu.org>
To: Juri Linkov <juri <at> jurta.org>
Cc: martin rudalics <rudalics <at> gmx.at>, 17554 <at> debbugs.gnu.org
Subject: Re: bug#17554: 24.3.91;
 [Regression] re-usage of dired *Marked Files* buffer window
Date: Tue, 27 May 2014 17:45:57 -0500
On Wed May 28 2014 Juri Linkov wrote:
> A good placement of the *Completions* buffer can be achieved by using:
> 
> (add-to-list 'display-buffer-alist '("\\*Completions\\*"
> display-buffer-at-bottom (nil)))
> 
> It works in Dired as well with different window configurations.

This displays the *Completions* buffer at the bottom, whereas 24.3
puts it above the *Marked Files* buffer.  I have no strong
preferences with this.  I expect either way is fine.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17554; Package emacs. (Fri, 06 Jun 2014 00:03:01 GMT) Full text and rfc822 format available.

Message #38 received at 17554 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> jurta.org>
To: "Roland Winkler" <winkler <at> gnu.org>
Cc: martin rudalics <rudalics <at> gmx.at>, 17554 <at> debbugs.gnu.org
Subject: Re: bug#17554: 24.3.91;
 [Regression] re-usage of dired *Marked Files* buffer window
Date: Fri, 06 Jun 2014 02:48:50 +0300
>> A good placement of the *Completions* buffer can be achieved by using:
>>
>> (add-to-list 'display-buffer-alist '("\\*Completions\\*"
>> display-buffer-at-bottom (nil)))
>>
>> It works in Dired as well with different window configurations.
>
> This displays the *Completions* buffer at the bottom, whereas 24.3
> puts it above the *Marked Files* buffer.  I have no strong
> preferences with this.  I expect either way is fine.

The *Completions* buffer is displayed by `internal-temp-output-buffer-show',
so adding a new action `display-buffer-at-bottom' to it would affect many
other unrelated commands besides completion commands.

To modify the behavior of only *Completions* we need to add it to
display-buffer-alist that will be non-empty by default:

=== modified file 'lisp/simple.el'
--- lisp/simple.el	2014-06-02 00:18:22 +0000
+++ lisp/simple.el	2014-06-05 23:43:17 +0000
@@ -7300,6 +7300,9 @@ (defun switch-to-completions ()
       ;; FIXME: Perhaps this should be done in `minibuffer-completion-help'.
       (when (bobp)
 	(next-completion 1)))))
+
+(add-to-list 'display-buffer-alist '("\\*Completions\\*" display-buffer-at-bottom (nil)))
+
 
 ;;; Support keyboard commands to turn on various modifiers.
 




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17554; Package emacs. (Fri, 06 Jun 2014 01:08:01 GMT) Full text and rfc822 format available.

Message #41 received at 17554 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Juri Linkov <juri <at> jurta.org>
Cc: 17554 <at> debbugs.gnu.org, Roland Winkler <winkler <at> gnu.org>
Subject: Re: bug#17554: 24.3.91;
 [Regression] re-usage of dired *Marked Files* buffer window
Date: Thu, 05 Jun 2014 21:07:02 -0400
> +(add-to-list 'display-buffer-alist '("\\*Completions\\*" display-buffer-at-bottom (nil)))

`display-buffer-alist' has to stay nil by default.


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17554; Package emacs. (Fri, 06 Jun 2014 04:18:01 GMT) Full text and rfc822 format available.

Message #44 received at 17554 <at> debbugs.gnu.org (full text, mbox):

From: "Roland Winkler" <winkler <at> gnu.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: Juri Linkov <juri <at> jurta.org>, 17554 <at> debbugs.gnu.org
Subject: Re: bug#17554: 24.3.91;
 [Regression] re-usage of dired *Marked Files* buffer window
Date: Thu, 5 Jun 2014 23:17:09 -0500
On Thu Jun 5 2014 Stefan Monnier wrote:
> > +(add-to-list 'display-buffer-alist '("\\*Completions\\*"
> display-buffer-at-bottom (nil)))
> 
> `display-buffer-alist' has to stay nil by default.

I do not know much about how emacs manages its windows.  Yet I am a
bit surprised that the above approach establishes a rather special
treatment of *Completions* buffers.  I'd say the problem is that *a*
buffer with typically more than two or three lines gets
automatically displayed in a window that is only three lines high.
We have a particular example where this happens to the *Completions*
buffer.  But if this happened with any other buffer this would be
equally annoying.  So it seems to me that this should be solved in a
more generic way.

Am I missing something?

Roland




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17554; Package emacs. (Fri, 06 Jun 2014 23:10:03 GMT) Full text and rfc822 format available.

Message #47 received at 17554 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> jurta.org>
To: "Roland Winkler" <winkler <at> gnu.org>
Cc: 17554 <at> debbugs.gnu.org, Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#17554: 24.3.91;
 [Regression] re-usage of dired *Marked Files* buffer window
Date: Sat, 07 Jun 2014 02:05:30 +0300
>> > +(add-to-list 'display-buffer-alist '("\\*Completions\\*" display-buffer-at-bottom (nil)))
>>
>> `display-buffer-alist' has to stay nil by default.
>
> I do not know much about how emacs manages its windows.  Yet I am a
> bit surprised that the above approach establishes a rather special
> treatment of *Completions* buffers.  I'd say the problem is that *a*
> buffer with typically more than two or three lines gets
> automatically displayed in a window that is only three lines high.
> We have a particular example where this happens to the *Completions*
> buffer.  But if this happened with any other buffer this would be
> equally annoying.  So it seems to me that this should be solved in a
> more generic way.
>
> Am I missing something?

This is how `display-buffer-use-some-window' works:
it calls `get-lru-window' to get the least recently used window
which is `*Marked Files*' in this case.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17554; Package emacs. (Fri, 06 Jun 2014 23:10:04 GMT) Full text and rfc822 format available.

Message #50 received at 17554 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> jurta.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 17554 <at> debbugs.gnu.org, Roland Winkler <winkler <at> gnu.org>
Subject: Re: bug#17554: 24.3.91;
 [Regression] re-usage of dired *Marked Files* buffer window
Date: Sat, 07 Jun 2014 02:04:11 +0300
>> +(add-to-list 'display-buffer-alist '("\\*Completions\\*" display-buffer-at-bottom (nil)))
>
> `display-buffer-alist' has to stay nil by default.

This will do the same without changing the default value of `display-buffer-alist':

=== modified file 'lisp/minibuffer.el'
--- lisp/minibuffer.el	2014-06-02 00:18:22 +0000
+++ lisp/minibuffer.el	2014-06-06 22:55:17 +0000
@@ -1796,7 +1796,10 @@ (defun minibuffer-completion-help (&opti
              ;; 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))
+             (display-buffer-mark-dedicated 'soft)
+	     (temp-buffer-show-function
+	      (lambda (buffer)
+		(temp-buffer-window-show buffer '(display-buffer-at-bottom)))))
         (with-output-to-temp-buffer "*Completions*"
           ;; Remove the base-size tail because `sort' requires a properly
           ;; nil-terminated list.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17554; Package emacs. (Mon, 09 Jun 2014 16:16:02 GMT) Full text and rfc822 format available.

Message #53 received at 17554 <at> debbugs.gnu.org (full text, mbox):

From: "Roland Winkler" <winkler <at> gnu.org>
To: Juri Linkov <juri <at> jurta.org>
Cc: 17554 <at> debbugs.gnu.org, Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#17554: 24.3.91;
 [Regression] re-usage of dired *Marked Files* buffer window
Date: Mon, 9 Jun 2014 11:15:36 -0500
On Sat Jun 7 2014 Juri Linkov wrote:
> > Am I missing something?
> 
> This is how `display-buffer-use-some-window' works:
> it calls `get-lru-window' to get the least recently used window
> which is `*Marked Files*' in this case.

I see.  Thanks for your efforts to get this fixed.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17554; Package emacs. (Tue, 10 Jun 2014 00:29:02 GMT) Full text and rfc822 format available.

Message #56 received at 17554 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> jurta.org>
To: "Roland Winkler" <winkler <at> gnu.org>
Cc: martin rudalics <rudalics <at> gmx.at>,
 Stefan Monnier <monnier <at> iro.umontreal.ca>, 17554 <at> debbugs.gnu.org
Subject: Re: bug#17554: 24.3.91;
 [Regression] re-usage of dired *Marked Files* buffer window
Date: Tue, 10 Jun 2014 03:12:08 +0300
>> > Am I missing something?
>>
>> This is how `display-buffer-use-some-window' works:
>> it calls `get-lru-window' to get the least recently used window
>> which is `*Marked Files*' in this case.
>
> I see.  Thanks for your efforts to get this fixed.

While the latest patch with `display-buffer-at-bottom' provides a better
behavior for displaying *Completions*, I'm afraid it can't be installed
into emacs-24 branch because it changes the behavior of *Completions*
instead of just fixing the regression.

Since `get-lru-window' has a higher precedence than `get-largest-window'
in `display-buffer-use-some-window', we need to find a way to
mark the *Marked Files* window as dedicated to not use it
for displaying *Compilations*.

I tried to set `dedicated' in the window action alist:

=== modified file 'lisp/dired.el'
--- lisp/dired.el	2014-05-08 19:22:43 +0000
+++ lisp/dired.el	2014-06-10 00:02:14 +0000
@@ -3104,7 +3104,8 @@ (defun dired-mark-pop-up (buffer-or-name
 	(with-current-buffer-window
 	 buffer
 	 (cons 'display-buffer-below-selected
-	       '((window-height . fit-window-to-buffer)))
+	       '((window-height . fit-window-to-buffer)
+		 (dedicated . t)))
 	 #'(lambda (window _value)
 	     (with-selected-window window
 	       (unwind-protect

but this doesn't seem to work.  Then I found a workable solution:

=== modified file 'lisp/dired.el'
--- lisp/dired.el	2014-05-08 19:22:43 +0000
+++ lisp/dired.el	2014-06-10 00:08:38 +0000
@@ -3099,7 +3099,11 @@ (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*")))
+	  (temp-buffer-window-show-hook
+	   (cons (lambda ()
+		   (set-window-dedicated-p window t))
+		 temp-buffer-window-show-hook)))
       (with-current-buffer buffer
 	(with-current-buffer-window
 	 buffer

But it's too ugly and produces compilation warning
"reference to free variable `window'".

Maybe Martin has better ideas?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17554; Package emacs. (Tue, 10 Jun 2014 06:08:01 GMT) Full text and rfc822 format available.

Message #59 received at 17554 <at> debbugs.gnu.org (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: Juri Linkov <juri <at> jurta.org>, Roland Winkler <winkler <at> gnu.org>
Cc: 17554 <at> debbugs.gnu.org, Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#17554: 24.3.91; [Regression] re-usage of dired *Marked Files*
 buffer window
Date: Tue, 10 Jun 2014 08:07:03 +0200
> Maybe Martin has better ideas?

The earlier behavior was handwoven and allowed three windows to coexist
simultaneously on one and the same frame.  We can't achieve that via
`display-buffer' because the default value of `split-height-threshold'
precludes it.  IMHO that value is ridiculously small and in practice
always inhibits popping up a third window.  But changing that value for
the release doesn't sound like a good idea to me.

So IIUC we have to write our own `split-window-preferred-function' here.
Unless anyone has a better idea ...

martin




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17554; Package emacs. (Tue, 10 Jun 2014 23:09:02 GMT) Full text and rfc822 format available.

Message #62 received at 17554 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> jurta.org>
To: martin rudalics <rudalics <at> gmx.at>
Cc: 17554 <at> debbugs.gnu.org, Roland Winkler <winkler <at> gnu.org>,
 Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#17554: 24.3.91;
 [Regression] re-usage of dired *Marked Files* buffer window
Date: Wed, 11 Jun 2014 01:57:30 +0300
> The earlier behavior was handwoven and allowed three windows to coexist
> simultaneously on one and the same frame.  We can't achieve that via
> `display-buffer' because the default value of `split-height-threshold'
> precludes it.  IMHO that value is ridiculously small and in practice
> always inhibits popping up a third window.  But changing that value for
> the release doesn't sound like a good idea to me.

The standard terminal size is 80x25.  80*2 = 160 which is a good
default width for `split-width-threshold'.  Correspondingly, 25*2 = 50
would be a better default height for `split-height-threshold'
to be changed in the trunk.  (Another good change for the trunk
is to use `display-buffer-at-bottom' for *Completions*).

> So IIUC we have to write our own `split-window-preferred-function' here.

For the emacs-24 branch `split-window-preferred-function' won't help
if the window height is smaller than `split-height-threshold',
and *Completions* still will be displayed in the small window
of *Marked Files*.  This could be fixed only by displaying
*Completions* in the window containing the Dired buffer
(without using split-window) like it was in previous releases.
This is why I tried to mark *Marked Files* as dedicated.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17554; Package emacs. (Wed, 11 Jun 2014 07:16:01 GMT) Full text and rfc822 format available.

Message #65 received at 17554 <at> debbugs.gnu.org (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: Juri Linkov <juri <at> jurta.org>
Cc: 17554 <at> debbugs.gnu.org, Roland Winkler <winkler <at> gnu.org>,
 Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#17554: 24.3.91; [Regression] re-usage of dired *Marked Files*
 buffer window
Date: Wed, 11 Jun 2014 09:15:06 +0200
> The standard terminal size is 80x25.  80*2 = 160 which is a good
> default width for `split-width-threshold'.  Correspondingly, 25*2 = 50
> would be a better default height for `split-height-threshold'
> to be changed in the trunk.  (Another good change for the trunk
> is to use `display-buffer-at-bottom' for *Completions*).

What does it use currently?

> For the emacs-24 branch `split-window-preferred-function' won't help
> if the window height is smaller than `split-height-threshold',

We'd have to write our own `split-window-preferred-function' which would
set `split-height-threshold' accordingly.  This is not entirely clean
though since we'd bind a user variable.  A user could override it via
`display-buffer-alist' but this is not entirely obvious.

Usually, the right choice would be to pass appropriate functions via the
ACTION argument.  Unfortunately, the `display-buffer' call issued for
*Completions* is virtually nested in the call for *Marked Files* which
makes things more complicated than expected.

(1) I wouldn't want to change the general behavior of how *Completions*
    are presented just in order to fix the problem at hand.

(2) Changing the ACTION argument for the `display-buffer' call used to
    show *Completions* such as to check whether a *Marked Files* buffer
    is currently shown and avoid using that or the original dired window
    is no viable alternative either.

(3) Marking any of the dired or *Marked Files* windows as dedicated is
    somewhat dangerous (even when done softly) when the user quits the
    *Completions* window in some non-standard, non-modal way.

(4) Using `display-buffer-overriding-action' is clearly to harsh.

> and *Completions* still will be displayed in the small window
> of *Marked Files*.  This could be fixed only by displaying
> *Completions* in the window containing the Dired buffer
> (without using split-window) like it was in previous releases.
> This is why I tried to mark *Marked Files* as dedicated.

But the 24.3 code handles Roland's scenario by displaying *Completions*
in a third window.  At least it does so here.  What do you get?

martin




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17554; Package emacs. (Thu, 12 Jun 2014 06:35:01 GMT) Full text and rfc822 format available.

Message #68 received at 17554 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> jurta.org>
To: martin rudalics <rudalics <at> gmx.at>
Cc: 17554 <at> debbugs.gnu.org, Roland Winkler <winkler <at> gnu.org>,
 Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#17554: 24.3.91;
 [Regression] re-usage of dired *Marked Files* buffer window
Date: Thu, 12 Jun 2014 09:33:11 +0300
> But the 24.3 code handles Roland's scenario by displaying *Completions*
> in a third window.  At least it does so here.  What do you get?

24.3 displays *Completions* in the window with the dired buffer
because the lru-window is the dired window in 24.3, but in 24.4
the lru-window is the small window with *Marked Files*.

Maybe it's possible to change window's timestamp after displaying
*Marked Files* to make the dired window lru, to display *Completions*
in it like in 24.3?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17554; Package emacs. (Mon, 16 Jun 2014 06:57:02 GMT) Full text and rfc822 format available.

Message #71 received at 17554 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> jurta.org>
To: martin rudalics <rudalics <at> gmx.at>
Cc: 17554 <at> debbugs.gnu.org, Roland Winkler <winkler <at> gnu.org>
Subject: Re: bug#17554: 24.3.91;
 [Regression] re-usage of dired *Marked Files* buffer window
Date: Mon, 16 Jun 2014 09:51:17 +0300
>> But the 24.3 code handles Roland's scenario by displaying *Completions*
>> in a third window.  At least it does so here.  What do you get?
>
> 24.3 displays *Completions* in the window with the dired buffer
> because the lru-window is the dired window in 24.3, but in 24.4
> the lru-window is the small window with *Marked Files*.
>
> Maybe it's possible to change window's timestamp after displaying
> *Marked Files* to make the dired window lru, to display *Completions*
> in it like in 24.3?

The problem is that `with-selected-window' calls `select-window' with
the non-nil arg `norecord' that doesn't update the window's use_time,
so the displayed window considered least-recently used.

I don't know how general this problem is, but at least for *Marked files*
the following patch causes the Dired window to be least-recently used,
thus avoiding using *Marked files* window to display *Completions*:

=== modified file 'lisp/dired.el'
--- lisp/dired.el	2014-05-08 19:22:43 +0000
+++ lisp/dired.el	2014-06-16 06:45:18 +0000
@@ -3107,6 +3107,7 @@ (defun dired-mark-pop-up (buffer-or-name
 	       '((window-height . fit-window-to-buffer)))
 	 #'(lambda (window _value)
 	     (with-selected-window window
+	       (select-window window) ;; use nil NORECORD to make window the most recently selected.
 	       (unwind-protect
 		   (apply function args)
 		 (when (window-live-p window)





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17554; Package emacs. (Mon, 16 Jun 2014 19:50:02 GMT) Full text and rfc822 format available.

Message #74 received at 17554 <at> debbugs.gnu.org (full text, mbox):

From: "Roland Winkler" <winkler <at> gnu.org>
To: Juri Linkov <juri <at> jurta.org>
Cc: martin rudalics <rudalics <at> gmx.at>, 17554 <at> debbugs.gnu.org
Subject: Re: bug#17554: 24.3.91;
 [Regression] re-usage of dired *Marked Files* buffer window
Date: Mon, 16 Jun 2014 14:49:40 -0500
On Mon Jun 16 2014 Juri Linkov wrote:
> I don't know how general this problem is, but at least for *Marked
> files* the following patch causes the Dired window to be
> least-recently used, thus avoiding using *Marked files* window to
> display *Completions*:

Just for the records: I guess there might be similar problems in
other usage cases, too.  However, using Emacs 24.3.91 I did not
encounter so far a 2nd scenario where a temporary buffer like
*Completions* gets displayed in a ridiculously small window.
We need two temp buffers like *Marked files* (small) and
*Completions* (bigger) for this bug to show up.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17554; Package emacs. (Mon, 16 Jun 2014 21:49:02 GMT) Full text and rfc822 format available.

Message #77 received at 17554 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: "Roland Winkler" <winkler <at> gnu.org>
Cc: Juri Linkov <juri <at> jurta.org>, 17554 <at> debbugs.gnu.org
Subject: Re: bug#17554: 24.3.91;
 [Regression] re-usage of dired *Marked Files* buffer window
Date: Mon, 16 Jun 2014 17:47:42 -0400
> 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".


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17554; Package emacs. (Tue, 17 Jun 2014 06:50:02 GMT) Full text and rfc822 format available.

Message #80 received at 17554 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> jurta.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 17554 <at> debbugs.gnu.org, Roland Winkler <winkler <at> gnu.org>
Subject: Re: bug#17554: 24.3.91;
 [Regression] re-usage of dired *Marked Files* buffer window
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.





Reply sent to Juri Linkov <juri <at> jurta.org>:
You have taken responsibility. (Wed, 18 Jun 2014 08:00:03 GMT) Full text and rfc822 format available.

Notification sent to "Roland Winkler" <winkler <at> gnu.org>:
bug acknowledged by developer. (Wed, 18 Jun 2014 08:00:04 GMT) Full text and rfc822 format available.

Message #85 received at 17554-done <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> jurta.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 17554-done <at> debbugs.gnu.org, Roland Winkler <winkler <at> gnu.org>
Subject: Re: bug#17554: 24.3.91;
 [Regression] re-usage of dired *Marked Files* buffer window
Date: Wed, 18 Jun 2014 10:57:54 +0300
>> 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*.

Regression is fixed in the emacs-24 branch.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17554; Package emacs. (Wed, 18 Jun 2014 08:20:01 GMT) Full text and rfc822 format available.

Message #88 received at 17554 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> jurta.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 17554 <at> debbugs.gnu.org, Roland Winkler <winkler <at> gnu.org>
Subject: Re: bug#17554: 24.3.91;
 [Regression] re-usage of dired *Marked Files* buffer window
Date: Wed, 18 Jun 2014 11:07:05 +0300
>>> +(add-to-list 'display-buffer-alist '("\\*Completions\\*" display-buffer-at-bottom (nil)))
>>
>> `display-buffer-alist' has to stay nil by default.
>
> This will do the same without changing the default value of `display-buffer-alist':

More changes are needed (for the trunk to better display *Completions*)
to copy all default actions from `display-buffer-fallback-action', but
replace `display-buffer-use-some-window' with `display-buffer-at-bottom':

=== modified file 'lisp/minibuffer.el'
--- lisp/minibuffer.el	2014-06-02 00:18:22 +0000
+++ lisp/minibuffer.el	2014-06-18 08:01:12 +0000
@@ -1796,7 +1796,21 @@ (defun minibuffer-completion-help (&opti
              ;; 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))
+             (display-buffer-mark-dedicated 'soft)
+	     ;; Disable `pop-up-windows' temporarily to allow
+	     ;; `display-buffer--maybe-pop-up-frame-or-window'
+	     ;; in the overridden actions below to pop up a frame
+	     ;; if `pop-up-frames' is non-nil, but not to pop up a window.
+	     ;; Use `display-buffer-at-bottom' to display completions
+	     ;; in a window at the bottom of the selected frame.
+	     (pop-up-windows nil)
+	     (temp-buffer-show-function
+	      (lambda (buffer)
+		(temp-buffer-window-show buffer '((display-buffer--maybe-same-window
+						   display-buffer-reuse-window
+						   display-buffer--maybe-pop-up-frame-or-window
+						   display-buffer-at-bottom)
+						  (window-height . fit-window-to-buffer))))))
         (with-output-to-temp-buffer "*Completions*"
           ;; Remove the base-size tail because `sort' requires a properly
           ;; nil-terminated list.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 16 Jul 2014 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 9 years and 293 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.