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


View this message in rfc822 format

From: martin rudalics <rudalics <at> gmx.at>
To: Dmitry Gutov <dmitry <at> gutov.dev>, Juri Linkov <juri <at> linkov.net>
Cc: 79125 <at> debbugs.gnu.org
Subject: bug#79125: quit-window fails to restore window height in a scenario of buffer reuse
Date: Fri, 1 Aug 2025 10:53:41 +0200
> I've tried it out, and it doesn't seem to fix the original scenario.

Right. The code should be

(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 (listp quad))
		  (eq (window-buffer window) (nth 0 quad)))
	  (shrink-window-if-larger-than-buffer window))))))

> If the goal was to implement your explanation from the other subthread:
>
>  > In the following cases:
>  >
>  > - The window is new.
>  >
>  > - The window was already in use for this buffer.
>
> ...then it seems fail because it resizes an existing window showing a different buffer. Probably because the value of QUAD is 'window', in my testing.

I tried your original scenario and it does not resize windows any more.
C-x v g followed by C-x 1 followed by l or d should work as before.

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.