[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#32825: 27.0.50; Deterministic window management
From: |
martin rudalics |
Subject: |
bug#32825: 27.0.50; Deterministic window management |
Date: |
Fri, 02 Nov 2018 09:43:36 +0100 |
>> 'window-min-height' is an option which causes functions to
>> check the height of all windows wrt a potential change. If, after the
>> change, the height of one window would drop below that value, the
>> change is not made. One can make an exeption for a specific window,
>> for example the one that should be resized or newly made, but not for
>> other windows that are probably not related to the change.
>
> I meant the same, but with one change: check the height of all windows
> with the default value of 'window-min-height' (i.e. 4), but check the
> height of the new created window with the value 'window-min-height'
> (e.g. 10) specified in an alist that should override the default value
> only for the window created by display-buffer-below-selected.
So you mean that if Emacs can't fulfill a 'window-height' contract for
a new window below the selected one, it shouldn't make a new one in
the first place? Then with an an alist entry called 'min-height' we
could rewrite 'display-buffer-below-selected' as follows:
(defun display-buffer-below-selected (buffer alist)
"Try displaying BUFFER in a window below the selected window.
If there is a window below the selected one and that window
already displays BUFFER, use that window. Otherwise, try to
create a new window below the selected one and show BUFFER there.
If that attempt fails as well and there is a non-dedicated window
below the selected one, use that window."
(let ((min-height (cdr (assq 'min-height alist)))
window)
(or (and (setq window (window-in-direction 'below))
(eq buffer (window-buffer window))
(window--display-buffer buffer window 'reuse alist))
(and (not (frame-parameter nil 'unsplittable))
(or (not (numberp min-height))
(window-sizable-p nil (- min-height)))
(let ((split-height-threshold 0)
split-width-threshold)
(setq window (window--try-to-split-window
(selected-window) alist)))
(window--display-buffer
buffer window 'window alist display-buffer-mark-dedicated))
(and (setq window (window-in-direction 'below))
(not (window-dedicated-p window))
(window--display-buffer
buffer window 'reuse alist display-buffer-mark-dedicated)))))
But would we (re-)use a window if it is not as large as 'min-height'?
Would we try to enlarge such a window? As far as we can?
BTW: Calling 'window--try-to-split-window' above is butt-ugly. We
should simply call 'split-window' instead. I have no idea what came
to my mind when I wrote that.
martin
- bug#32825: 27.0.50; Deterministic window management, martin rudalics, 2018/11/01
- bug#32825: 27.0.50; Deterministic window management, Juri Linkov, 2018/11/01
- bug#32825: 27.0.50; Deterministic window management,
martin rudalics <=
- bug#32825: 27.0.50; Deterministic window management, Juri Linkov, 2018/11/03
- bug#32825: 27.0.50; Deterministic window management, martin rudalics, 2018/11/04
- bug#32825: 27.0.50; Deterministic window management, Juri Linkov, 2018/11/04
- bug#32825: 27.0.50; Deterministic window management, martin rudalics, 2018/11/05
- bug#32825: 27.0.50; Deterministic window management, Juri Linkov, 2018/11/05
- bug#32825: 27.0.50; Deterministic window management, martin rudalics, 2018/11/06
- bug#32825: 27.0.50; Deterministic window management, Juri Linkov, 2018/11/06
- bug#32825: 27.0.50; Deterministic window management, martin rudalics, 2018/11/07
- bug#32825: 27.0.50; Deterministic window management, Juri Linkov, 2018/11/07
- bug#32825: 27.0.50; Deterministic window management, martin rudalics, 2018/11/08