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]> Sun, 2 Aug 2026 09:42:43 +0200
Newsgroups gmane.emacs.bugs
Message-ID <[email protected]>
 > I think we need to add a error after lines 183-191
 >
 > (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")))
 >
 > Which would be like (unless (cdr winls) (user-error "Not enough
 > windows to rotate."))

Then what about the following scenario:

(let* ((window1 (selected-window))
        (window2 (split-window))
        (window3 (split-window window2)))
   (set-window-buffer window2 (get-buffer-create "*b2"))
   (set-window-buffer window3 (get-buffer-create "*b3"))
   (set-window-dedicated-p window1 t)
   (y-or-n-p "Rotate? ")
   (rotate-windows))

Here it puts *b3* in the window that formerly showed *scratch*.

 > We could also add custom user variable that allows for rotating
 > dedicated windows, if we do I think it should be a value such that:
 > - nil = don't rotate dedicated windows
 > - 1 = only rotate dedicated windows if all windows are dedicated
 > - 2 = rotate dedicated windows if only one window is not dedicated
 > - t = always rotate dedicated windows
 >
 > Or we could make this a prefix argument. But in my opinion this would
 > be overengineering, as the user can simply just un dedicate the window
 > of their use case get's more complex

AFAICT handling dedicated windows specially in 'rotate-windows' _is_
over-engineering.  Note that people dedicate windows mostly to avoid that
'display-buffer' shows another buffer in them.  So please reconsider.

martin