From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#55169: Can't combine window-min-height with window-height Date: Fri, 06 May 2022 10:52:44 +0300 Organization: LINKOV.NET Message-ID: <86v8ujcd2r.fsf@mail.linkov.net> References: <86y1zp5but.fsf@mail.linkov.net> <87czh0gp6m.fsf@gnus.org> <9753db0e-05f2-5927-80fb-50d17f16441d@gmx.at> <86czgxi3nn.fsf@mail.linkov.net> <86tua7pyfp.fsf@mail.linkov.net> <5e93dcad-4071-b4e2-d408-ba670413eb67@gmx.at> <868rriil03.fsf@mail.linkov.net> <0e9b53c4-b283-ca20-fa8a-995f2b58ed59@gmx.at> <865ymlje5o.fsf@mail.linkov.net> <8ae5e6ac-25f5-3feb-b05b-fbdb71e7ac1d@gmx.at> <864k24v0vo.fsf@mail.linkov.net> <865ymkrmze.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="794"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (x86_64-pc-linux-gnu) Cc: Lars Ingebrigtsen , 55169@debbugs.gnu.org To: martin rudalics Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri May 06 10:02:05 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nmsub-000AWQ-4K for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 06 May 2022 10:02:05 +0200 Original-Received: from localhost ([::1]:47568 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nmsuZ-0005AY-Pb for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 06 May 2022 04:02:03 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:49000) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nmssj-0004G5-FU for bug-gnu-emacs@gnu.org; Fri, 06 May 2022 04:00:10 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:53100) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nmssd-0004oi-Oo for bug-gnu-emacs@gnu.org; Fri, 06 May 2022 04:00:08 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nmssd-0001sc-IU for bug-gnu-emacs@gnu.org; Fri, 06 May 2022 04:00:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 06 May 2022 08:00:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 55169 X-GNU-PR-Package: emacs Original-Received: via spool by 55169-submit@debbugs.gnu.org id=B55169.16518239507128 (code B ref 55169); Fri, 06 May 2022 08:00:03 +0000 Original-Received: (at 55169) by debbugs.gnu.org; 6 May 2022 07:59:10 +0000 Original-Received: from localhost ([127.0.0.1]:46997 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nmsrm-0001qu-FO for submit@debbugs.gnu.org; Fri, 06 May 2022 03:59:10 -0400 Original-Received: from relay4-d.mail.gandi.net ([217.70.183.196]:59107) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nmsrk-0001qU-BN for 55169@debbugs.gnu.org; Fri, 06 May 2022 03:59:08 -0400 Original-Received: (Authenticated sender: juri@linkov.net) by mail.gandi.net (Postfix) with ESMTPSA id A0884E0002; Fri, 6 May 2022 07:59:01 +0000 (UTC) In-Reply-To: (martin rudalics's message of "Fri, 6 May 2022 09:02:51 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:231477 Archived-At: >> Because it should be the task of fit-window-to-buffer, >> and it already has the argument MIN-HEIGHT. >> Also other arguments of fit-window-to-buffer >> could be allowed to use in display-buffer-alist. > > You mean the value of a 'window-height' entry could also be a > > • A list whose CAR is a function and whose remaining elements > are the arguments passed to that function. > > so we'd run > > (ignore-errors (funcall (car height) window (nth 1 height) ...)) > > in 'window--display-buffer'? Which means the caller has to know the > function and which arguments it needs in which order. Sounds fragile. It is intended only for special handling of 'fit-window-to-buffer'. If 'fit-window-to-buffer' with MIN-HEIGHT will really fix this problem, then details of the entry format could be adapted later. And indeed this works exactly as should with (pop-to-buffer (generate-new-buffer "*edit string*") '(display-buffer-below-selected (window-height . fit-window-to-buffer))) and an experimental patch: diff --git a/lisp/window.el b/lisp/window.el index 9f78784612..a21cf109a4 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -7336,7 +7336,9 @@ window--display-buffer (window-resize window delta nil 'safe t))) (setq resize-temp-buffer-window-inhibit 'vertical)) ((functionp height) - (ignore-errors (funcall height window)) + (if (eq height 'fit-window-to-buffer) + (ignore-errors (funcall height window nil 10)) + (ignore-errors (funcall height window))) (setq resize-temp-buffer-window-inhibit 'vertical))) ;; Adjust width of window if asked for. (cond