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: Mon, 09 May 2022 21:58:17 +0300 Organization: LINKOV.NET Message-ID: <868rray1me.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> <86v8ujcd2r.fsf@mail.linkov.net> <3f7b273c-59f4-5486-728e-a0c8e09190a7@gmx.at> <86bkwahe5g.fsf@mail.linkov.net> <86mtfrj3bh.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="31377"; 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 Mon May 09 21:02:21 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 1no8eC-0007ys-D3 for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 09 May 2022 21:02:20 +0200 Original-Received: from localhost ([::1]:48414 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1no8eB-00053c-4S for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 09 May 2022 15:02:19 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:60800) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1no8dv-0004zv-N4 for bug-gnu-emacs@gnu.org; Mon, 09 May 2022 15:02:05 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:37339) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1no8dv-0005GJ-E2 for bug-gnu-emacs@gnu.org; Mon, 09 May 2022 15:02:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1no8dv-0002ot-Bi for bug-gnu-emacs@gnu.org; Mon, 09 May 2022 15:02: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: Mon, 09 May 2022 19:02: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.165212287210755 (code B ref 55169); Mon, 09 May 2022 19:02:03 +0000 Original-Received: (at 55169) by debbugs.gnu.org; 9 May 2022 19:01:12 +0000 Original-Received: from localhost ([127.0.0.1]:59467 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1no8d6-0002nO-GE for submit@debbugs.gnu.org; Mon, 09 May 2022 15:01:12 -0400 Original-Received: from relay7-d.mail.gandi.net ([217.70.183.200]:60971) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1no8d4-0002mv-Qj for 55169@debbugs.gnu.org; Mon, 09 May 2022 15:01:11 -0400 Original-Received: (Authenticated sender: juri@linkov.net) by mail.gandi.net (Postfix) with ESMTPSA id A28B72000C; Mon, 9 May 2022 19:01:02 +0000 (UTC) In-Reply-To: (martin rudalics's message of "Mon, 9 May 2022 09:24:52 +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:231774 Archived-At: >>>> (pop-to-buffer (generate-new-buffer "*edit string*") >>>> '(display-buffer-below-selected >>>> (window-height . (lambda (window) >>>> (fit-window-to-buffer window nil 10))))) >>> >>> Sounds too complicated IMO. >> >> Actually a lambda is already supported, so no changes are required. > > We have to find a suitable way to explain that in the manual. It's already documented in the manual: • If the value specifies a function, that function is called with one argument—the chosen window. The function is supposed to adjust the height of the window; its return value is ignored. Suitable functions are ‘fit-window-to-buffer’ and ‘shrink-window-if-larger-than-buffer’, see *note Resizing Windows::. It would be nice to add just a small example of a lambda with more args for fit-window-to-buffer or shrink-window-if-larger-than-buffer. >> A special case for fit-window-to-buffer, shrink-window-* and other similar >> could be implemented only when you are sure that a `window-min-height' entry >> is not going to be used for other purposes besides of using it as an argument >> of a window-height entry. > > You said that this is the case for 'fit-window-to-buffer' and that > function is the canonical client for a 'window-height' function. So why > bother about the rest? You found another function shrink-window-if-larger-than-buffer. Then it would be better not to limit only to these two. >> BTW, fit-window-to-buffer has also other arguments: MAX-WIDTH and MIN-WIDTH. >> Would they be useful for a window-width entry? > > Maybe. But let's talk about MAX-HEIGHT first. Maybe MAX-WIDTH is not needed after all, as much as MAX-HEIGHT. >>> And if we really want to, we can always add a MIN-HEIGHT argument to >>> 'shrink-window-if-larger-than-buffer' and handle it the same way. >> >> This is very much needed, thanks. > > See below (this should also fix the lie about the return value). Thanks, I'll test it. Does it need more args from fit-window-to-buffer?