GNU bug report logs - #78835
Wrong pop-to-buffer behavior after one display-buffer-in-side-window call

Previous Next

Package: emacs;

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

Date: Thu, 19 Jun 2025 02:20: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>, 78835 <at> debbugs.gnu.org
Subject: bug#78835: Wrong pop-to-buffer behavior after one display-buffer-in-side-window call
Date: Fri, 20 Jun 2025 09:32:47 +0200
> That seems to fix it indeed, thanks.

Pushed to master.

> On a related topic though, another scenario that happens over here is
> 'quit-window' restoring a window _width_ to a value that looks
> unexpected to me. For example, just now after applying your patch from
> a buffer, I pressed 'q' and the window (the one on the left in a
> configuration similar to test scenario) got resized to 2/3rds of its
> width. Any ideas about that perhaps?

Hmm...  Apply

a/lisp/window.el b/lisp/window.el
index f24e581ba1e..b27e1ca56e9 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -5452,6 +5452,10 @@ quit-restore-window
 		 (if (window-combined-p window)
                      (/= (nth 3 quad) (window-total-height window))
                    (/= (nth 3 quad) (window-total-width window))))
+
+	(unless (window-combined-p window)
+	  (y-or-n-p "Adjusting width, continue? "))
+
 	;; Try to resize WINDOW to its old height but don't signal an
 	;; error.
 	(condition-case nil

If and when it asks you, apply

diff --git a/lisp/window.el b/lisp/window.el
index f24e581ba1e..a6f93e067b5 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -5899,15 +5899,14 @@ split-window
 	   window (- (if new-parent 1.0 (window-normal-size window horizontal))
 		     new-normal)))

-	(unless horizontal
-	  (let ((quit-restore (window-parameter window 'quit-restore)))
-	    (when quit-restore
-	      (let ((quad (nth 1 quit-restore)))
-		(when (and (listp quad) (integerp (nth 3 quad)))
-		  ;; When WINDOW has a 'quit-restore' parameter that
-		  ;; specifies a previous height to restore, remove that
-		  ;; - it does more harm than good now (Bug#78835).
-		  (setf (nth 3 quad) nil))))))
+	(let ((quit-restore (window-parameter window 'quit-restore)))
+	  (when quit-restore
+	    (let ((quad (nth 1 quit-restore)))
+	      (when (and (listp quad) (integerp (nth 3 quad)))
+		;; When WINDOW has a 'quit-restore' parameter that
+		;; specifies a previous height to restore, remove that
+		;; - it does more harm than good now (Bug#78835).
+		(setf (nth 3 quad) nil)))))

 	(let ((new (split-window-internal
 		    window new-pixel-size side new-normal refer)))

and tell me if it asks you again.

> It is very sporadic, and I don't have any reliable reproduction, so if
> if it doesn't ring a bell, I can try to get more info first.

I don't recall that I ever tried to restore a previous width too but
apparently I did (and did not even document it).

martin




This bug report was last modified 28 days ago.

Previous Next


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