From 57b119b296ed1cefaad6b7e42c1e4c37ba23cdf8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emil=20Ingelman=20Sahl=C3=A9n?= Date: Fri, 27 Mar 2026 19:48:02 +0100 Subject: [PATCH] Fix recombination of side windows (Bug#80665) * lisp/window.el (window--make-major-side-window): Protect the sibling (the main-window group) from recombination. Without this, deleting a side window can flatten the group into the root, causing subsequent side windows on other sides to be placed incorrectly (Bug#80665). Copyright-paperwork-exempt: yes --- lisp/window.el | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lisp/window.el b/lisp/window.el index 1f7ae726f49..be92a695b2b 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -1010,6 +1010,14 @@ and may be called only if no window on SIDE exists yet." (cons `(dedicated . ,(or display-buffer-mark-dedicated 'side)) alist)))) (when window + ;; Protect the sibling (the main-window group) from recombination. + ;; Without this, deleting a side window can flatten the group into + ;; the root, causing subsequent side windows on other sides to be + ;; placed incorrectly (Bug#80665). + (when-let* ((sibling (or (window-prev-sibling window) + (window-next-sibling window))) + (window-child sibling)) + (set-window-combination-limit sibling t)) ;; Initialize `window-side' parameter of new window to SIDE and ;; make that parameter persistent. (set-window-parameter window 'window-side side)