GNU bug report logs -
#73627
29.3; window-main-window: Discrepancy between behaviour and docstring
Previous Next
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 73627 in the body.
You can then email your comments to 73627 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#73627
; Package
emacs
.
(Fri, 04 Oct 2024 15:44:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
"Nussbaum Ferdinand" <ferdinand.nussbaum <at> inf.ethz.ch>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Fri, 04 Oct 2024 15:44:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
To reproduce from emacs -Q, evaluate in the scratch buffer:
(display-buffer-in-side-window
(get-scratch-buffer-create)
'((side . left)))
(split-window (frame-root-window) nil 'below)
(window-main-window)
Observe that (window-main-window) returns the selected window. However, the
window that was created by splitting below is not a side window, and it does not
descend from the selected window. This contradicts part of the docstring of
window-main-window:
"If FRAME has no side windows, return FRAME's root window. Otherwise, return
either an internal non-side window such that all other non-side windows on FRAME
descend from it, or the single live non-side window of FRAME."
Splitting a frame's root window in the presence of side windows seems to often
lead to such discrepancies. I have observed such behaviour in the packages hydra
(on ELPA, in its lv-window function), and shell-pop (from another package
archive).
Related to that: Is the following supposed to be an invariant for each frame,
and should it be considered a bug when packages violate it?
Invariant:
There exists a window MAIN such that for all live windows WIN (other than MAIN)
we have: WIN descends from MAIN if and only if it is not a side window.
This is something I assumed and was surprised to see violated.
Best,
Ferdinand
[Message part 2 (text/html, inline)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#73627
; Package
emacs
.
(Sat, 05 Oct 2024 11:16:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 73627 <at> debbugs.gnu.org (full text, mbox):
> From: "Nussbaum Ferdinand" <ferdinand.nussbaum <at> inf.ethz.ch>
> Date: Fri, 4 Oct 2024 15:09:18 +0000
>
> To reproduce from emacs -Q, evaluate in the scratch buffer:
>
> (display-buffer-in-side-window
> (get-scratch-buffer-create)
> '((side . left)))
> (split-window (frame-root-window) nil 'below)
> (window-main-window)
>
> Observe that (window-main-window) returns the selected window. However, the
> window that was created by splitting below is not a side window, and it does not
> descend from the selected window. This contradicts part of the docstring of
> window-main-window:
>
> "If FRAME has no side windows, return FRAME's root window. Otherwise, return
> either an internal non-side window such that all other non-side windows on FRAME
> descend from it, or the single live non-side window of FRAME."
>
> Splitting a frame's root window in the presence of side windows seems to often
> lead to such discrepancies. I have observed such behaviour in the packages hydra
> (on ELPA, in its lv-window function), and shell-pop (from another package
> archive).
>
> Related to that: Is the following supposed to be an invariant for each frame,
> and should it be considered a bug when packages violate it?
>
> Invariant:
> There exists a window MAIN such that for all live windows WIN (other than MAIN)
> we have: WIN descends from MAIN if and only if it is not a side window.
>
> This is something I assumed and was surprised to see violated.
Martin, any comments?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#73627
; Package
emacs
.
(Sat, 05 Oct 2024 14:39:01 GMT)
Full text and
rfc822 format available.
Message #11 received at 73627 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
>> To reproduce from emacs -Q, evaluate in the scratch buffer:
>>
>> (display-buffer-in-side-window
>> (get-scratch-buffer-create)
>> '((side . left)))
>> (split-window (frame-root-window) nil 'below)
>> (window-main-window)
>>
>> Observe that (window-main-window) returns the selected window. However, the
>> window that was created by splitting below is not a side window, and it does not
>> descend from the selected window. This contradicts part of the docstring of
>> window-main-window:
>>
>> "If FRAME has no side windows, return FRAME's root window. Otherwise, return
>> either an internal non-side window such that all other non-side windows on FRAME
>> descend from it, or the single live non-side window of FRAME."
This accusation is correct.
>> Splitting a frame's root window in the presence of side windows seems to often
>> lead to such discrepancies. I have observed such behaviour in the packages hydra
>> (on ELPA, in its lv-window function), and shell-pop (from another package
>> archive).
>>
>> Related to that: Is the following supposed to be an invariant for each frame,
>> and should it be considered a bug when packages violate it?
>>
>> Invariant:
>> There exists a window MAIN such that for all live windows WIN (other than MAIN)
>> we have: WIN descends from MAIN if and only if it is not a side window.
It should be an invariant and it is a bug when packages (or, as in the
case at hand Emacs itself) violate it.
>> This is something I assumed and was surprised to see violated.
>
> Martin, any comments?
Ferdinand is right. 'split-window' must split the frame's main window
instead of the root window. Patch attached. It should be OK for the
release version but I won't insist since the bug has been with us ever
since side windows exist.
Thanks for the report, martin
[window.el.diff (text/x-patch, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#73627
; Package
emacs
.
(Sat, 12 Oct 2024 12:10:03 GMT)
Full text and
rfc822 format available.
Message #14 received at 73627 <at> debbugs.gnu.org (full text, mbox):
> Date: Sat, 5 Oct 2024 16:37:50 +0200
> Cc: 73627 <at> debbugs.gnu.org
> From: martin rudalics <rudalics <at> gmx.at>
>
> Ferdinand is right. 'split-window' must split the frame's main window
> instead of the root window. Patch attached. It should be OK for the
> release version but I won't insist since the bug has been with us ever
> since side windows exist.
Thanks. Feel free to install on master (or tell me if you want me to
do that).
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#73627
; Package
emacs
.
(Sun, 13 Oct 2024 08:18:01 GMT)
Full text and
rfc822 format available.
Message #17 received at 73627 <at> debbugs.gnu.org (full text, mbox):
> Thanks. Feel free to install on master (or tell me if you want me to
> do that).
Installed on master.
Thanks, martin
Reply sent
to
martin rudalics <rudalics <at> gmx.at>
:
You have taken responsibility.
(Sun, 20 Oct 2024 08:36:01 GMT)
Full text and
rfc822 format available.
Notification sent
to
"Nussbaum Ferdinand" <ferdinand.nussbaum <at> inf.ethz.ch>
:
bug acknowledged by developer.
(Sun, 20 Oct 2024 08:36:02 GMT)
Full text and
rfc822 format available.
Message #22 received at 73627-done <at> debbugs.gnu.org (full text, mbox):
Version: 31.1
> Installed on master.
Closing this bug, martin
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Sun, 17 Nov 2024 12:24:07 GMT)
Full text and
rfc822 format available.
This bug report was last modified 275 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.