GNU bug report logs -
#1806
dired-pop-to-buffer in wrong place
Previous Next
Reported by: Juri Linkov <juri <at> jurta.org>
Date: Tue, 6 Jan 2009 15:40:04 UTC
Severity: normal
Done: Juri Linkov <juri <at> jurta.org>
Bug is archived. No further changes may be made.
Full log
Message #65 received at 1806 <at> emacsbugs.donarmstrong.com (full text, mbox):
> Usually this worked correctly due to the fact that directory buffers
> were sufficiently high. But for `pop-up-frames' non-nil addicts this
> was not necessarily the right behavior.
>
> Anyway, I suppose you mean something like
>
> (defun dired-pop-to-buffer (buf)
> (let* ((split-height-threshold 8)
> split-width-threshold
> (buffer (get-buffer-create buf))
> (window (window--try-to-split-window (selected-window))))
> (if window
> (progn
> (select-window window)
> (set-window-buffer window buffer))
> (pop-to-buffer buffer))
> (when dired-shrink-to-fit
> (fit-window-to-buffer nil nil 1))))
Thank you, this works almost ideally. The only problem I've encountered
is that sometimes it resizes existing windows:
+------------+------------+ +------------+------------+
| | | | | |
| | | | | |
| dired | other2 | | dired | other2 |
| | | | | |
| | | +------------+ |
| | | | file list | |
| | | ===> +------------+ |
+------------+ | | | |
| | | | | |
| other1 | | | other1 | |
| | | | | |
| | | | | |
+------------+------------+ +------------+------------+
Please notice how the upper border of the lower window (other1)
was moved up. I think it should keep the existing configuration
and create a new window at the cost of space from the original
dired buffer like this:
+------------+------------+ +------------+------------+
| | | | | |
| | | | | |
| dired | other | | dired | other |
| | | | | |
| | | | | |
| | | +------------+ |
| | | | file list | |
+------------+ | ===> +------------+ |
| | | | | |
| other | | | other | |
| | | | | |
| | | | | |
+------------+------------+ +------------+------------+
As I can see currently `fit-window-to-buffer' always takes space
from the bottom window, but we need it from the top window.
>> Please see the code in calendar.el that creates such standard layout
>> for non-wide-screen configurations (i.e. when there is no right window).
>> I think we should keep exactly the same logic for wide-screen configurations,
>> i.e. treating the creation of such small low windows as if there is no
>> existing side window.
>
> Would the above code handle that?
I believe it would handle these cases. Maybe it is possible to create
a single function e.g. `pop-to-buffer-below' that will display a new window
below from the current window taking its space.
--
Juri Linkov
http://www.jurta.org/emacs/
This bug report was last modified 12 years and 236 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.