unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#73627: 29.3; window-main-window: Discrepancy between behaviour and docstring
@ 2024-10-04 15:09 Nussbaum  Ferdinand
  2024-10-05 11:15 ` Eli Zaretskii
  0 siblings, 1 reply; 5+ messages in thread
From: Nussbaum  Ferdinand @ 2024-10-04 15:09 UTC (permalink / raw)
  To: 73627

[-- Attachment #1: Type: text/plain, Size: 1349 bytes --]

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


[-- Attachment #2: Type: text/html, Size: 6862 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-10-13  8:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-04 15:09 bug#73627: 29.3; window-main-window: Discrepancy between behaviour and docstring Nussbaum  Ferdinand
2024-10-05 11:15 ` Eli Zaretskii
2024-10-05 14:37   ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-12 11:55     ` Eli Zaretskii
2024-10-13  8:16       ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).