GNU bug report logs - #79125
quit-window fails to restore window height in a scenario of buffer reuse

Previous Next

Package: emacs;

Reported by: Dmitry Gutov <dmitry <at> gutov.dev>

Date: Wed, 30 Jul 2025 02:01:02 UTC

Severity: normal

Full log


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

From: martin rudalics <rudalics <at> gmx.at>
To: Juri Linkov <juri <at> linkov.net>
Cc: Dmitry Gutov <dmitry <at> gutov.dev>, 79125 <at> debbugs.gnu.org
Subject: Re: bug#79125: quit-window fails to restore window height in a
 scenario of buffer reuse
Date: Thu, 31 Jul 2025 10:46:09 +0200
>> Do you have any ideas why 'resize-temp-buffer-window-inhibit' does not
>> apply here?
>
> It seems 'resize-temp-buffer-window-inhibit' is not an user option
> since 'window--display-buffer' changes its value.

I meant why 'window--display-buffer' would not have set it ...

> But I meant
> other cases since there is no auto-resizing in Dmitry's test case
> while using these settings:
>
> (remove-hook 'vc-diff-finish-functions 'vc-shrink-buffer-window)
> (remove-hook 'vc-log-finish-functions 'vc-shrink-buffer-window)

... which explains it, thanks.  So the resizing happens outside the
scope of 'display-buffer'.  We could rewrite 'vc-shrink-buffer-window'
as

(defun vc-shrink-buffer-window (&optional buffer)
  "Call `shrink-window-if-larger-than-buffer' only when BUFFER is visible.
BUFFER defaults to the current buffer."
  (let ((window (get-buffer-window buffer t)))
    (when window
      (let* ((quit-restore (window-parameter window 'quit-restore))
	     (quad (and quit-restore (nth 1 quit-restore))))
	(when (or (not quit-restore) (not (list quad))
		  (eq (window-buffer window) (nth 0 quad)))
	  (shrink-window-if-larger-than-buffer window))))))

but I'm not sure whether people will like it.

martin




This bug report was last modified 10 days ago.

Previous Next


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