From: martin rudalics <rudalics@gmx.at>
To: Eli Zaretskii <eliz@gnu.org>, JD Smith <jdtsmith@gmail.com>
Cc: 64405@debbugs.gnu.org
Subject: bug#64405: `toggle-side-windows' with 3 or more side windows leads to error; reproducer included
Date: Fri, 7 Jul 2023 15:56:22 +0200 [thread overview]
Message-ID: <d7604744-4cb7-9fa5-91fe-566ff28231fd@gmx.at> (raw)
In-Reply-To: <83mt09iju2.fsf@gnu.org>
[-- Attachment #1: Type: text/plain, Size: 2650 bytes --]
>> From a fresh Emacs 28 emacs -Q:
>>
>> (progn
>> (display-buffer-in-side-window (get-buffer-create "AA") '((side . right) (slot . -1)))
>> (display-buffer-in-side-window (get-buffer-create "BB") '((side . right) (slot . 0)))
>> (display-buffer-in-side-window (get-buffer-create "CC") '((side . right) (slot . 1)))
>> (window-toggle-side-windows)
>> (window-toggle-side-windows))
>>
>> Leads to the error `Specified root is not an ancestor of specified window’. This arises as:
>>
>> Debugger entered--Lisp error: (error "Specified root is not an ancestor of specified win...")
>> delete-other-windows-internal(nil #<window 16>)
>> window-state-put((((min-height . 4) (min-width . 10) (min-height-ignore . 2) (min-width-ignore . 7) (min-height-safe . 1) (min-width-safe . 2) (min-pixel-height . 64) (min-pixel-width . 70) (min-pixel-height-ignore . 32) (min-pixel-width-ignore . 49) (min-pixel-height-safe . 16) (min-pixel-width-safe . 14)) leaf (pixel-width . 591) (pixel-height . 560) (total-width . 84) (total-height . 35) (normal-height . 1.0) (normal-width . 1.0) (parameters (clone-of . #<window 3 on *scratch*>)) (buffer #<buffer *scratch*> (selected . t) (hscroll . 0) (fringes 8 8 nil nil) (margins nil) (scroll-bars nil 3 t nil 0 t nil) (vscroll . 0) (dedicated) (point . #<marker at 480 in *scratch*>) (start . #<marker at 1 in *scratch*>))) #<window 16>)
>> window-toggle-side-windows()
>> (progn (display-buffer-in-side-window (get-buffer-create "AA") '((side . right) (slot . -1))) (display-buffer-in-side-window (get-buffer-create "BB") '((side . right) (slot . 0))) (display-buffer-in-side-window (get-buffer-create "CC") '((side . right) (slot . 1))) (window-toggle-side-windows) (window-toggle-side-windows))
>> (progn (progn (display-buffer-in-side-window (get-buffer-create "AA") '((side . right) (slot . -1))) (display-buffer-in-side-window (get-buffer-create "BB") '((side . right) (slot . 0))) (display-buffer-in-side-window (get-buffer-create "CC") '((side . right) (slot . 1))) (window-toggle-side-windows) (window-toggle-side-windows)))
>> elisp--eval-last-sexp(nil)
>> eval-last-sexp(nil)
>> funcall-interactively(eval-last-sexp nil)
>> command-execute(eval-last-sexp)
>>
>> Strangely no error is seen with 1 or 2 side windows.
>
> Martin, any ideas or comments? This still happens in Emacs 29 and
> Emacs 30.
The bug is an immediate consequence of my ill-advised "fix" for
Bug#50867. A better fix for both bugs should be the attached one.
Please test it for the scenarios of Bug#50867 and the present one.
martin
[-- Attachment #2: window-state-put.diff --]
[-- Type: text/x-patch, Size: 1348 bytes --]
diff --git a/lisp/window.el b/lisp/window.el
index 16f16a75418..145558bb773 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -6169,7 +6169,14 @@ window--state-put-1
(let* ((horizontal (eq type 'hc))
(total (window-size window horizontal pixelwise))
(first t)
- (window-combination-limit (cdr (assq 'combination-limit state)))
+ ;; Make sure to make a new parent window for a horizontal
+ ;; or vertical combination embedded in one of the same type
+ ;; (see Bug#50867 and Bug#64405).
+ (window-combination-limit
+ (and (or (eq (cdr (assq 'combination-limit state)) t)
+ (and horizontal (window-combined-p window t))
+ (and (not horizontal) (window-combined-p window)))
+ t))
size new)
(dolist (item state)
;; Find the next child window. WINDOW always points to the
@@ -6409,7 +6416,10 @@ window-state-put
head)))
(min-width (cdr (assq
(if pixelwise 'min-pixel-width 'min-weight)
- head))))
+ head)))
+ ;; Bind the following two variables. `window--state-put-1' has
+ ;; to fully control them (see Bug#50867 and Bug#64405).
+ window-combination-limit window-combination-resize)
(if (and (not totals)
(or (> min-height (window-size window nil pixelwise))
(> min-width (window-size window t pixelwise)))
next prev parent reply other threads:[~2023-07-07 13:56 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-01 19:48 bug#64405: `toggle-side-windows' with 3 or more side windows leads to error; reproducer included JD Smith
2023-07-06 7:24 ` Eli Zaretskii
2023-07-07 13:56 ` martin rudalics [this message]
2023-07-08 9:06 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d7604744-4cb7-9fa5-91fe-566ff28231fd@gmx.at \
--to=rudalics@gmx.at \
--cc=64405@debbugs.gnu.org \
--cc=eliz@gnu.org \
--cc=jdtsmith@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.