* bug#17554: 24.3.91; [Regression] re-usage of dired *Marked Files* buffer window
@ 2014-05-22 19:59 Roland Winkler
2014-05-23 1:07 ` Stefan Monnier
2014-05-23 5:48 ` Eli Zaretskii
0 siblings, 2 replies; 28+ messages in thread
From: Roland Winkler @ 2014-05-22 19:59 UTC (permalink / raw)
To: 17554
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
^ permalink raw reply [flat|nested] 28+ messages in thread
* bug#17554: 24.3.91; [Regression] re-usage of dired *Marked Files* buffer window
2014-05-22 19:59 bug#17554: 24.3.91; [Regression] re-usage of dired *Marked Files* buffer window Roland Winkler
@ 2014-05-23 1:07 ` Stefan Monnier
2014-05-23 2:17 ` Roland Winkler
2014-05-23 5:48 ` Eli Zaretskii
1 sibling, 1 reply; 28+ messages in thread
From: Stefan Monnier @ 2014-05-23 1:07 UTC (permalink / raw)
To: Roland Winkler; +Cc: 17554
> 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
^ permalink raw reply [flat|nested] 28+ messages in thread
* bug#17554: 24.3.91; [Regression] re-usage of dired *Marked Files* buffer window
2014-05-23 1:07 ` Stefan Monnier
@ 2014-05-23 2:17 ` Roland Winkler
2014-05-23 6:06 ` Eli Zaretskii
2014-05-23 7:24 ` martin rudalics
0 siblings, 2 replies; 28+ messages in thread
From: Roland Winkler @ 2014-05-23 2:17 UTC (permalink / raw)
To: Stefan Monnier; +Cc: 17554
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.
^ permalink raw reply [flat|nested] 28+ messages in thread
* bug#17554: 24.3.91; [Regression] re-usage of dired *Marked Files* buffer window
2014-05-23 2:17 ` Roland Winkler
@ 2014-05-23 6:06 ` Eli Zaretskii
2014-05-23 7:24 ` martin rudalics
1 sibling, 0 replies; 28+ messages in thread
From: Eli Zaretskii @ 2014-05-23 6:06 UTC (permalink / raw)
To: Roland Winkler; +Cc: 17554
> Date: Thu, 22 May 2014 21:17:27 -0500
> From: "Roland Winkler" <winkler@gnu.org>
> Cc: 17554@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.
^ permalink raw reply [flat|nested] 28+ messages in thread
* bug#17554: 24.3.91; [Regression] re-usage of dired *Marked Files* buffer window
2014-05-23 2:17 ` Roland Winkler
2014-05-23 6:06 ` Eli Zaretskii
@ 2014-05-23 7:24 ` martin rudalics
2014-05-23 21:32 ` Juri Linkov
1 sibling, 1 reply; 28+ messages in thread
From: martin rudalics @ 2014-05-23 7:24 UTC (permalink / raw)
To: Roland Winkler, Stefan Monnier; +Cc: 17554
> 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
^ permalink raw reply [flat|nested] 28+ messages in thread
* bug#17554: 24.3.91; [Regression] re-usage of dired *Marked Files* buffer window
2014-05-23 7:24 ` martin rudalics
@ 2014-05-23 21:32 ` Juri Linkov
2014-05-27 21:54 ` Juri Linkov
0 siblings, 1 reply; 28+ messages in thread
From: Juri Linkov @ 2014-05-23 21:32 UTC (permalink / raw)
To: martin rudalics; +Cc: 17554, Roland Winkler
>> 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.
^ permalink raw reply [flat|nested] 28+ messages in thread
* bug#17554: 24.3.91; [Regression] re-usage of dired *Marked Files* buffer window
2014-05-23 21:32 ` Juri Linkov
@ 2014-05-27 21:54 ` Juri Linkov
2014-05-27 22:45 ` Roland Winkler
0 siblings, 1 reply; 28+ messages in thread
From: Juri Linkov @ 2014-05-27 21:54 UTC (permalink / raw)
To: martin rudalics; +Cc: 17554, Roland Winkler
>> 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.
^ permalink raw reply [flat|nested] 28+ messages in thread
* bug#17554: 24.3.91; [Regression] re-usage of dired *Marked Files* buffer window
2014-05-27 21:54 ` Juri Linkov
@ 2014-05-27 22:45 ` Roland Winkler
2014-06-05 23:48 ` Juri Linkov
0 siblings, 1 reply; 28+ messages in thread
From: Roland Winkler @ 2014-05-27 22:45 UTC (permalink / raw)
To: Juri Linkov; +Cc: 17554
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.
^ permalink raw reply [flat|nested] 28+ messages in thread
* bug#17554: 24.3.91; [Regression] re-usage of dired *Marked Files* buffer window
2014-05-27 22:45 ` Roland Winkler
@ 2014-06-05 23:48 ` Juri Linkov
2014-06-06 1:07 ` Stefan Monnier
0 siblings, 1 reply; 28+ messages in thread
From: Juri Linkov @ 2014-06-05 23:48 UTC (permalink / raw)
To: Roland Winkler; +Cc: 17554
>> 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)))
+
\f
;;; Support keyboard commands to turn on various modifiers.
^ permalink raw reply [flat|nested] 28+ messages in thread
* bug#17554: 24.3.91; [Regression] re-usage of dired *Marked Files* buffer window
2014-06-05 23:48 ` Juri Linkov
@ 2014-06-06 1:07 ` Stefan Monnier
2014-06-06 4:17 ` Roland Winkler
2014-06-06 23:04 ` Juri Linkov
0 siblings, 2 replies; 28+ messages in thread
From: Stefan Monnier @ 2014-06-06 1:07 UTC (permalink / raw)
To: Juri Linkov; +Cc: 17554, Roland Winkler
> +(add-to-list 'display-buffer-alist '("\\*Completions\\*" display-buffer-at-bottom (nil)))
`display-buffer-alist' has to stay nil by default.
Stefan
^ permalink raw reply [flat|nested] 28+ messages in thread
* bug#17554: 24.3.91; [Regression] re-usage of dired *Marked Files* buffer window
2014-06-06 1:07 ` Stefan Monnier
@ 2014-06-06 4:17 ` Roland Winkler
2014-06-06 23:05 ` Juri Linkov
2014-06-06 23:04 ` Juri Linkov
1 sibling, 1 reply; 28+ messages in thread
From: Roland Winkler @ 2014-06-06 4:17 UTC (permalink / raw)
To: Stefan Monnier; +Cc: 17554
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
^ permalink raw reply [flat|nested] 28+ messages in thread
* bug#17554: 24.3.91; [Regression] re-usage of dired *Marked Files* buffer window
2014-06-06 4:17 ` Roland Winkler
@ 2014-06-06 23:05 ` Juri Linkov
2014-06-09 16:15 ` Roland Winkler
0 siblings, 1 reply; 28+ messages in thread
From: Juri Linkov @ 2014-06-06 23:05 UTC (permalink / raw)
To: Roland Winkler; +Cc: 17554
>> > +(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.
^ permalink raw reply [flat|nested] 28+ messages in thread
* bug#17554: 24.3.91; [Regression] re-usage of dired *Marked Files* buffer window
2014-06-06 23:05 ` Juri Linkov
@ 2014-06-09 16:15 ` Roland Winkler
2014-06-10 0:12 ` Juri Linkov
0 siblings, 1 reply; 28+ messages in thread
From: Roland Winkler @ 2014-06-09 16:15 UTC (permalink / raw)
To: Juri Linkov; +Cc: 17554
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.
^ permalink raw reply [flat|nested] 28+ messages in thread
* bug#17554: 24.3.91; [Regression] re-usage of dired *Marked Files* buffer window
2014-06-09 16:15 ` Roland Winkler
@ 2014-06-10 0:12 ` Juri Linkov
2014-06-10 6:07 ` martin rudalics
0 siblings, 1 reply; 28+ messages in thread
From: Juri Linkov @ 2014-06-10 0:12 UTC (permalink / raw)
To: Roland Winkler; +Cc: 17554
>> > 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?
^ permalink raw reply [flat|nested] 28+ messages in thread
* bug#17554: 24.3.91; [Regression] re-usage of dired *Marked Files* buffer window
2014-06-10 0:12 ` Juri Linkov
@ 2014-06-10 6:07 ` martin rudalics
2014-06-10 22:57 ` Juri Linkov
0 siblings, 1 reply; 28+ messages in thread
From: martin rudalics @ 2014-06-10 6:07 UTC (permalink / raw)
To: Juri Linkov, Roland Winkler; +Cc: 17554
> 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
^ permalink raw reply [flat|nested] 28+ messages in thread
* bug#17554: 24.3.91; [Regression] re-usage of dired *Marked Files* buffer window
2014-06-10 6:07 ` martin rudalics
@ 2014-06-10 22:57 ` Juri Linkov
2014-06-11 7:15 ` martin rudalics
0 siblings, 1 reply; 28+ messages in thread
From: Juri Linkov @ 2014-06-10 22:57 UTC (permalink / raw)
To: martin rudalics; +Cc: 17554, Roland Winkler
> 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.
^ permalink raw reply [flat|nested] 28+ messages in thread
* bug#17554: 24.3.91; [Regression] re-usage of dired *Marked Files* buffer window
2014-06-10 22:57 ` Juri Linkov
@ 2014-06-11 7:15 ` martin rudalics
2014-06-12 6:33 ` Juri Linkov
0 siblings, 1 reply; 28+ messages in thread
From: martin rudalics @ 2014-06-11 7:15 UTC (permalink / raw)
To: Juri Linkov; +Cc: 17554, Roland Winkler
> 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
^ permalink raw reply [flat|nested] 28+ messages in thread
* bug#17554: 24.3.91; [Regression] re-usage of dired *Marked Files* buffer window
2014-06-11 7:15 ` martin rudalics
@ 2014-06-12 6:33 ` Juri Linkov
2014-06-16 6:51 ` Juri Linkov
0 siblings, 1 reply; 28+ messages in thread
From: Juri Linkov @ 2014-06-12 6:33 UTC (permalink / raw)
To: martin rudalics; +Cc: 17554, Roland Winkler
> 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?
^ permalink raw reply [flat|nested] 28+ messages in thread
* bug#17554: 24.3.91; [Regression] re-usage of dired *Marked Files* buffer window
2014-06-12 6:33 ` Juri Linkov
@ 2014-06-16 6:51 ` Juri Linkov
2014-06-16 19:49 ` Roland Winkler
0 siblings, 1 reply; 28+ messages in thread
From: Juri Linkov @ 2014-06-16 6:51 UTC (permalink / raw)
To: martin rudalics; +Cc: 17554, Roland Winkler
>> 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)
^ permalink raw reply [flat|nested] 28+ messages in thread
* bug#17554: 24.3.91; [Regression] re-usage of dired *Marked Files* buffer window
2014-06-16 6:51 ` Juri Linkov
@ 2014-06-16 19:49 ` Roland Winkler
2014-06-16 21:47 ` Stefan Monnier
0 siblings, 1 reply; 28+ messages in thread
From: Roland Winkler @ 2014-06-16 19:49 UTC (permalink / raw)
To: Juri Linkov; +Cc: 17554
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.
^ permalink raw reply [flat|nested] 28+ messages in thread
* bug#17554: 24.3.91; [Regression] re-usage of dired *Marked Files* buffer window
2014-06-16 19:49 ` Roland Winkler
@ 2014-06-16 21:47 ` Stefan Monnier
2014-06-17 6:44 ` Juri Linkov
0 siblings, 1 reply; 28+ messages in thread
From: Stefan Monnier @ 2014-06-16 21:47 UTC (permalink / raw)
To: Roland Winkler; +Cc: 17554
> 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
^ permalink raw reply [flat|nested] 28+ messages in thread
* bug#17554: 24.3.91; [Regression] re-usage of dired *Marked Files* buffer window
2014-06-16 21:47 ` Stefan Monnier
@ 2014-06-17 6:44 ` Juri Linkov
2014-06-18 7:57 ` Juri Linkov
0 siblings, 1 reply; 28+ messages in thread
From: Juri Linkov @ 2014-06-17 6:44 UTC (permalink / raw)
To: Stefan Monnier; +Cc: 17554, Roland Winkler
>> 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.
^ permalink raw reply [flat|nested] 28+ messages in thread
* bug#17554: 24.3.91; [Regression] re-usage of dired *Marked Files* buffer window
2014-06-17 6:44 ` Juri Linkov
@ 2014-06-18 7:57 ` Juri Linkov
0 siblings, 0 replies; 28+ messages in thread
From: Juri Linkov @ 2014-06-18 7:57 UTC (permalink / raw)
To: Stefan Monnier; +Cc: 17554-done, Roland Winkler
>> 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.
^ permalink raw reply [flat|nested] 28+ messages in thread
* bug#17554: 24.3.91; [Regression] re-usage of dired *Marked Files* buffer window
2014-06-06 1:07 ` Stefan Monnier
2014-06-06 4:17 ` Roland Winkler
@ 2014-06-06 23:04 ` Juri Linkov
2014-06-18 8:07 ` Juri Linkov
1 sibling, 1 reply; 28+ messages in thread
From: Juri Linkov @ 2014-06-06 23:04 UTC (permalink / raw)
To: Stefan Monnier; +Cc: 17554, Roland Winkler
>> +(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.
^ permalink raw reply [flat|nested] 28+ messages in thread
* bug#17554: 24.3.91; [Regression] re-usage of dired *Marked Files* buffer window
2014-06-06 23:04 ` Juri Linkov
@ 2014-06-18 8:07 ` Juri Linkov
0 siblings, 0 replies; 28+ messages in thread
From: Juri Linkov @ 2014-06-18 8:07 UTC (permalink / raw)
To: Stefan Monnier; +Cc: 17554, Roland Winkler
>>> +(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.
^ permalink raw reply [flat|nested] 28+ messages in thread
* bug#17554: 24.3.91; [Regression] re-usage of dired *Marked Files* buffer window
2014-05-22 19:59 bug#17554: 24.3.91; [Regression] re-usage of dired *Marked Files* buffer window Roland Winkler
2014-05-23 1:07 ` Stefan Monnier
@ 2014-05-23 5:48 ` Eli Zaretskii
2014-05-23 7:25 ` martin rudalics
1 sibling, 1 reply; 28+ messages in thread
From: Eli Zaretskii @ 2014-05-23 5:48 UTC (permalink / raw)
To: Roland Winkler; +Cc: 17554
> Date: Thu, 22 May 2014 14:59:33 -0500
> From: "Roland Winkler" <winkler@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.
^ permalink raw reply [flat|nested] 28+ messages in thread
* bug#17554: 24.3.91; [Regression] re-usage of dired *Marked Files* buffer window
2014-05-23 5:48 ` Eli Zaretskii
@ 2014-05-23 7:25 ` martin rudalics
2014-05-23 7:31 ` Eli Zaretskii
0 siblings, 1 reply; 28+ messages in thread
From: martin rudalics @ 2014-05-23 7:25 UTC (permalink / raw)
To: Eli Zaretskii, Roland Winkler; +Cc: 17554
>> 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
^ permalink raw reply [flat|nested] 28+ messages in thread
* bug#17554: 24.3.91; [Regression] re-usage of dired *Marked Files* buffer window
2014-05-23 7:25 ` martin rudalics
@ 2014-05-23 7:31 ` Eli Zaretskii
0 siblings, 0 replies; 28+ messages in thread
From: Eli Zaretskii @ 2014-05-23 7:31 UTC (permalink / raw)
To: martin rudalics; +Cc: 17554, winkler
> Date: Fri, 23 May 2014 09:25:06 +0200
> From: martin rudalics <rudalics@gmx.at>
> CC: 17554@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.
^ permalink raw reply [flat|nested] 28+ messages in thread
end of thread, other threads:[~2014-06-18 8:07 UTC | newest]
Thread overview: 28+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-22 19:59 bug#17554: 24.3.91; [Regression] re-usage of dired *Marked Files* buffer window Roland Winkler
2014-05-23 1:07 ` Stefan Monnier
2014-05-23 2:17 ` Roland Winkler
2014-05-23 6:06 ` Eli Zaretskii
2014-05-23 7:24 ` martin rudalics
2014-05-23 21:32 ` Juri Linkov
2014-05-27 21:54 ` Juri Linkov
2014-05-27 22:45 ` Roland Winkler
2014-06-05 23:48 ` Juri Linkov
2014-06-06 1:07 ` Stefan Monnier
2014-06-06 4:17 ` Roland Winkler
2014-06-06 23:05 ` Juri Linkov
2014-06-09 16:15 ` Roland Winkler
2014-06-10 0:12 ` Juri Linkov
2014-06-10 6:07 ` martin rudalics
2014-06-10 22:57 ` Juri Linkov
2014-06-11 7:15 ` martin rudalics
2014-06-12 6:33 ` Juri Linkov
2014-06-16 6:51 ` Juri Linkov
2014-06-16 19:49 ` Roland Winkler
2014-06-16 21:47 ` Stefan Monnier
2014-06-17 6:44 ` Juri Linkov
2014-06-18 7:57 ` Juri Linkov
2014-06-06 23:04 ` Juri Linkov
2014-06-18 8:07 ` Juri Linkov
2014-05-23 5:48 ` Eli Zaretskii
2014-05-23 7:25 ` martin rudalics
2014-05-23 7:31 ` Eli Zaretskii
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).