GNU bug report logs - #32825
27.0.50; Deterministic window management

Previous Next

Package: emacs;

Reported by: Juri Linkov <juri <at> linkov.net>

Date: Mon, 24 Sep 2018 19:15:02 UTC

Severity: minor

Tags: moreinfo

Found in version 27.0.50

Fixed in version 29.0.50

Done: Juri Linkov <juri <at> linkov.net>

Bug is archived. No further changes may be made.

Full log


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

From: martin rudalics <rudalics <at> gmx.at>
To: Juri Linkov <juri <at> linkov.net>
Cc: Michael Heerdegen <michael_heerdegen <at> web.de>, 32825 <at> debbugs.gnu.org
Subject: Re: 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




This bug report was last modified 3 years and 24 days ago.

Previous Next


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