bug#81406: 31.0.90; rotate-windows loses window balance when window-combination-resize is t

martin rudalics via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <[email protected]> Thu, 6 Aug 2026 09:34:42 +0200
Newsgroups gmane.emacs.bugs
Message-ID <[email protected]>
 > Ok I think it sounds more reasonable(as well as the fact I really
 > don't want to debug the above code haha) to remove dedicated window
 > handling in that case, maybe if someone requests it in the future we
 > can maybe look into it. I think this should be just as simple as
 > removing a couple of lines from the definition of winls to be:
 >
 > (seq-filter #'window-live-p (flatten-list win-tree))
 >
 > Also in the commit, can we also change the author email to my current
 > one instead of the one that is there (hosting your own email server is
 > more time consuming than expected)

I can offer the attached.  If Eli and Sean don't object, I'll apply it
to the release branch.

martin
rotate-windows.diff (text/x-patch, 4.3 KB)
diff --git a/doc/lispref/windows.texi b/doc/lispref/windows.texi
index 908c7f63d17..66baf3a5c14 100644
--- a/doc/lispref/windows.texi
+++ b/doc/lispref/windows.texi
@@ -2415,16 +2415,15 @@ Changing Window Layouts
 @end deffn
 
 @cindex rotating windows
-The final two commands can be used to @dfn{rotate} windows within the existing
-layout.  They are like the commands that rotate the layout but leave the
-underlying structure of the layout unchanged.  What actually changes are
-the positions of windows within the existing layout.  This happens in a
-way that the space formerly occupied by any window will be occupied by
-the window preceding (following if @var{reverse} is non-@code{nil}) it
-in the cyclic ordering of windows (@pxref{Cyclic Window Ordering}) on
-@var{window}'s frame.  These commands may signal an error if windows
-chosen to rotate are dedicated to their buffers, atomic or of fixed
-size.
+The final two commands can be used to @dfn{rotate} windows within the
+existing layout.  They are like the commands that rotate the layout but
+leave the underlying structure of the layout unchanged.  What actually
+changes are the positions of windows within the existing layout.  This
+happens in a way that the space formerly occupied by any window will be
+occupied by the window preceding (following if @var{reverse} is
+non-@code{nil}) it in the cyclic ordering of windows (@pxref{Cyclic
+Window Ordering}) on @var{window}'s frame.  These commands may signal an
+error if windows chosen to rotate are atomic or of fixed size.
 
 @deffn Command rotate-windows &optional window reverse
 This command rotates @var{window}'c child windows in cyclic ordering.
diff --git a/lisp/window-x.el b/lisp/window-x.el
index 8cb24a06674..49296dabae3 100644
--- a/lisp/window-x.el
+++ b/lisp/window-x.el
@@ -2,7 +2,7 @@
 
 ;; Copyright (C) 2025-2026 Free Software Foundation, Inc.
 
-;; Author: Pranshu Sharma <[email protected]>
+;; Author: Pranshu Sharma <[email protected]>
 ;;         Martin Rudalics <[email protected]>
 ;; Maintainer: [email protected]
 ;; Keywords: window, convenience
@@ -154,9 +154,8 @@ rotate-windows
 windows of the selected window's parent.
 
 Optional argument REVERSE non-nil means to rotate windows backwards, in
-reverse cyclic order.  Signal an error if WINDOW is not a parent window,
-all descendants of WINDOW are dedicated or some windows are of fixed
-size or atomic.
+reverse cyclic order.  Signal an error if WINDOW is not a parent window
+or some descendants of WINDOW are of fixed size or atomic.
 
 Rotating windows leaves the way a frame layout has been produced via
 splitting, deleting and resizing windows unaltered.  It only \"moves\"
@@ -183,12 +182,8 @@ rotate-windows
 	 (winls (or
                  (seq-filter
                   (lambda (win)
-                    (and (window-live-p win)
-                         (not (window-dedicated-p win))))
-                  (flatten-list win-tree))
-                 ;; Do we really care - the window/buffer relationship
-                 ;; should not be affected by rotating.
-                 (user-error "All windows are dedicated")))
+                    (window-live-p win))
+                  (flatten-list win-tree))))
 	 (rotated-ls (if reverse
 			 (append (cdr winls) (list (car winls)))
 		       (append (last winls) winls)))
@@ -199,8 +194,7 @@ rotate-windows
           (named-let rec ((tree win-tree))
             (cond
              ((consp tree) (cons (rec (car tree)) (rec (cdr tree))))
-             ((and (window-live-p tree)
-                   (not (window-dedicated-p tree)))
+             ((window-live-p tree)
               (pop rotated-ls))
              (t tree)))))
     (when (or (seq-some #'window-atom-root winls)
@@ -223,8 +217,8 @@ rotate-windows-back
 WINDOW must be a parent window and defaults to the main window of the
 selected frame.  Interactively, with a prefix argument, rotate backwards
 the child windows of the selected window's parent.  Signal an error if
-WINDOW is not a parent window, all descendants of WINDOW are dedicated
-or some of them are of fixed size or atomic.
+WINDOW is not a parent window or some descendants of WINDOW are of fixed
+size or atomic.
 
 Rotating windows backwards leaves the way a frame layout has been
 produced via splitting, deleting and resizing windows unaltered.  It