From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: martin rudalics Newsgroups: gmane.emacs.bugs Subject: bug#63455: 30.0.50; display-buffer-in-direction is always resizing Date: Sat, 13 May 2023 10:56:16 +0200 Message-ID: <8f609c16-2302-2dca-0c5a-b740da6e1686@gmx.at> References: <87fs82z7cw.fsf@web.de> <77edb1db-13ad-fa1d-d1fc-7a23f0b6240d@gmx.at> <86zg69lb6v.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="2351"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Michael Heerdegen , 63455@debbugs.gnu.org, dgutov@yandex.ru To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat May 13 10:57:34 2023 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 1pxl4I-0000St-5y for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 13 May 2023 10:57:34 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pxl3p-0001Nn-3e; Sat, 13 May 2023 04:57:05 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pxl3m-0001NF-Tw for bug-gnu-emacs@gnu.org; Sat, 13 May 2023 04:57:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pxl3m-0004uG-Lq for bug-gnu-emacs@gnu.org; Sat, 13 May 2023 04:57:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pxl3m-0005Wb-HW for bug-gnu-emacs@gnu.org; Sat, 13 May 2023 04:57:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: martin rudalics Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 13 May 2023 08:57:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63455 X-GNU-PR-Package: emacs Original-Received: via spool by 63455-submit@debbugs.gnu.org id=B63455.168396819321198 (code B ref 63455); Sat, 13 May 2023 08:57:02 +0000 Original-Received: (at 63455) by debbugs.gnu.org; 13 May 2023 08:56:33 +0000 Original-Received: from localhost ([127.0.0.1]:35870 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pxl3I-0005Vq-KA for submit@debbugs.gnu.org; Sat, 13 May 2023 04:56:33 -0400 Original-Received: from mout.gmx.net ([212.227.17.22]:59527) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pxl3G-0005Vd-D1 for 63455@debbugs.gnu.org; Sat, 13 May 2023 04:56:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.at; s=s31663417; t=1683968183; i=rudalics@gmx.at; bh=hOUxWJpQp69SA9Ax7pZgwRIX/fwategTwVzzd54+goA=; h=X-UI-Sender-Class:Date:Subject:To:Cc:References:From:In-Reply-To; b=FnV1hveDOsKyiaLr211eTIfHBn75wi30+XUx5Tftar8kdiQ6zmb4PChqc3gk1jTp+ qWGzizEfD/tddBhtN34Vt5phnphAyXUNHnGk7l3Spv5RX9690KXFELRxTmI9t5sHbi Tf4Sa8QRRXvwRSxH5k62N5FR3/9wELWb+BjVzJSrLmN/6/lL/p2v545/geY6l+Mx/a 4z+zXOfJN4JD40zXxrrITyaFG9Hb8m4cVLiT3U1AXGN8M+pAW9vgGaixnl/6NM5VKc TbKv/ZG38iD9Z49KYFMFipye6Se1uOepV5M6/bJ+EWhvDomDH5zHmCIjAjjw0ziS2Y ws/5pDQPnwd/Q== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Original-Received: from [192.168.1.100] ([212.95.5.250]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1M4b1y-1pw79d0Iuk-001hNM; Sat, 13 May 2023 10:56:23 +0200 Content-Language: en-US In-Reply-To: <86zg69lb6v.fsf@mail.linkov.net> X-Provags-ID: V03:K1:uJZklcEmln6O+q3UEgOOkyHcKyP8puJ0AZTWwlDYPnfUF9m9z5W bvKLDsgISzT1DkZVnBkoOF2t08V9IxPwzPJoA4Tqr8ukNK+AgtMADABf2CLiMLD988A6r2d cyCFhNP2HH/e0Bx4tnlcPCoLPynNptC1n6E6b6qyBKOUAXYOs8gQwbUyXL9MXX/wLDpfIwK MBb5WQeyXj4StsXsZTVmA== UI-OutboundReport: notjunk:1;M01:P0:RdeTeHEGieo=;YDWZN9rYbxCHCAsC9Z36m2ngNqY n2XeCR4HmPRJULPhuD6lfLcINyTdeV4b3ChgZi0vITlzBOWWGjqL3iG6H1ogDd43JqLhiD9El sVEhg+KPIuPcjEU3EVyNw9Kltr+WFsavbEm24FJO3QsPMVbNHpqPgtcAB8GHjH+44PObkQvIN VkOgJGQix9PRyv04kluvk8vmUGlJLSB3ofwj1/q7BQmdpsGKR/FPmF0xXIytktftyJmt5t4ub +XFVph1QIWwLMb8qnC/DL+g/xCq2C1BPm80gC8Y/WXuE8GJFXU4UVI4s8/wbveHSCI62NiJEz MXlGRUawDoYYXYjKdzgKAHznb4s7iDqRqxgoXUFp54G8ZfgVtoY1cpaTXgmIsCXl9jiUpTdO0 dSqHYC0YglZhjPVM2HZZUCvqOz/vC2J2dNPD2rdED3YQkn+G9ucRiu7dcIPOKU1s90SEyb8r8 3kpWpVbox0ViimwJoeWk6+9GTgGTRr8vSydHrtRQVFkjalr7Fly40bpQo2w/7U5ulnvqhy7j6 5qrf+7JcGmvMKIBUlja0PRMwVbmfePmywfpNs7ogHRY4uGCucHWm9P+mG/442N56rk3Crn8TB u88bsdTEQsKoozZaHVF8Ofp4yyl5mh0iYF3YA2i6GLImnGqRWtlfTSxsHvQIABWZ+eG/1Um2m zQTo5UnDUh5jTZbXMZHnogI1t9ShIR3+6M/Q5HuXbMxJZ4/sfaPK0zP+U8477wY2yhm/fAgC2 Rd+IgBIWVX+e+QtGVUOX/vrWdPzY/DM1uYEuSNdBcI33HtMz3YMU8ldQDttGqpdB8OwERw5q 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:261674 Archived-At: > There are 3 uses of 'display-buffer--maybe-at-bottom' in the Emacs > source tree: 'project-kill-buffers' and 'save-buffers-kill-emacs' > override the default. But 'hack-local-variables-confirm' > depends on the current default value. In 'hack-local-variables-confirm' I'm using (pop-to-buffer buf '(display-buffer--maybe-at-bottom (window-height . (fit-window-to-buffer)))) > Are these changes intended to completely remove these lines from > 'display-buffer-in-direction' and 'display-buffer--maybe-at-bottom'? > > `(,(if temp-buffer-resize-mode > '(window-height . resize-temp-buffer-window) > '(window-height . fit-window-to-buffer)) > ,(when temp-buffer-resize-mode > '(preserve-size . (nil . t)))) Yes. > I expected that only 1 line should be removed to change this to: > > `(,(when temp-buffer-resize-mode > '(window-height . resize-temp-buffer-window)) > ,(when temp-buffer-resize-mode > '(preserve-size . (nil . t)))) That wouldn't help. Try with (defun display-buffer--maybe-at-bottom (buffer alist) (let ((alist (append alist `(,(when temp-buffer-resize-mode '(window-height . resize-temp-buffer-window)) ,(when temp-buffer-resize-mode '(preserve-size . (nil . t))))))) (or (display-buffer--maybe-same-window buffer alist) (display-buffer-reuse-window buffer alist) (display-buffer--maybe-pop-up-frame buffer alist) (display-buffer-at-bottom buffer alist)))) (setq temp-buffer-resize-mode t) (pop-to-buffer (get-buffer-create "*foo*") '(display-buffer--maybe-at-bottom)) 'temp-buffer-resize-mode' is a global variable. Once a user customized it to t, _any_ buffer that passes through one of these functions will be resized, regardless of whether it is a temporary buffer or an "ordinary" one. > But if all lines should be removed, then how to use it? > I tried with your patch, but this doesn't resize the window: > > (setq temp-buffer-resize-mode t) > (display-buffer (current-buffer) > '((display-buffer-in-direction) . ((direction . top)))) Right. You can use, for example, (setq temp-buffer-resize-mode t) (temp-buffer-window-show (current-buffer) '((display-buffer-in-direction) . ((direction . top)))) which obviously makes the current buffer temporary with all its consequences. But 'temp-buffer-resize-mode' _is_ about temporary buffers. Note that when 'temp-buffer-resize-mode' is set, the way Emacs handles this currently is wrong for _two_ reasons: - When 'display-buffer' calls one of these functions it will resize the window regardless of whether it should be resized or not - that's the subject of the present bug. - When the user customizes 'display-buffer-alist' to call another display action, say 'display-buffer-below-selected', the window will not be resized. Try without and with the first form evaluated: (setq display-buffer-alist '(("*foo*" display-buffer-below-selected))) (pop-to-buffer (get-buffer-create "*foo*") '(display-buffer--maybe-at-bottom)) We could add a buffer-local variable say 'temporary' which the temporary buffer functions would set and 'display-buffer' would always obey in conjunction with 'temp-buffer-resize-mode'. Then a program or the user could set or reset that variable to obtain the desired behavior with plain 'display-buffer' calls as well. Whether such an option is clean is another question. martin