When ignoring parameters let 'split-window' split root window (Bug#76317)
authorMartin Rudalics <rudalics@gmx.at>
Mon, 17 Feb 2025 08:29:37 +0000 (09:29 +0100)
committerEshel Yaron <me@eshelyaron.com>
Tue, 18 Feb 2025 08:52:07 +0000 (09:52 +0100)
This fixes a behavior introduced by the fix of Bug#73527 that splits the
main window when the caller asks for splitting the root window.

* lisp/window.el (window--make-major-side-window): Bind
'ignore-window-parameters' to t so 'split-window' won't mess
with the WINDOW argument when it specifies the root window.
(split-window): If 'ignore-window-parameters' is non-nil, don't
try to split the main window instead of the root window.

(cherry picked from commit 310f62a9489b9c00d5e60d2ab16e7dc54afcadb9)

lisp/window.el

index 4359c678540e732412973a8e31db68215307f420..88c569f684d9ee0a15a1c1797b656a53a3e72e6c 100644 (file)
@@ -1002,6 +1002,7 @@ and may be called only if no window on SIDE exists yet."
         ;; window and not make a new parent window unless needed.
         (window-combination-resize 'side)
         (window-combination-limit nil)
+        (ignore-window-parameters t)
         (window (split-window-no-error next-to nil on-side))
          (alist (if (assq 'dedicated alist)
                     alist
@@ -5597,6 +5598,7 @@ changed by this function."
        ;; frame's root window, split the frame's main window instead
        ;; (Bug#73627).
        ((and (eq window (frame-root-window frame))
+            (not ignore-window-parameters)
             (window-with-parameter 'window-side nil frame))
        (throw 'done (split-window (window-main-window frame)
                                   size side pixelwise refer)))