emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Window tree and window's internal height


From: Eli Zaretskii
Subject: Window tree and window's internal height
Date: Sat, 17 Nov 2018 14:58:20 +0200

Martin, I'd like your opinion on the following two issues.  (Anyone
else who has an opinion is welcome to chime in.)

First, we have this in the ELisp manual:

     A minibuffer window (*note Minibuffer Windows::) is not part of its
  frame’s window tree unless the frame is a minibuffer-only frame.
  Nonetheless, most of the functions in this section accept the minibuffer
  window as an argument.  Also, the function ‘window-tree’ described at
  the end of this section lists the minibuffer window alongside the actual
  window tree.

The first sentence is incorrect, isn't it?  Because Emacs disagrees:

  emacs -Q
  M-: (window-next-sibling) RET
   => #<window 4 on  *Minibuf-0*>

And if that sentence is incorrect, we don't need the next two
"exceptions", right?

Next, please have a look at the function window_internal_height:

  /* Return number of lines of text (not counting mode lines) in W.  */

  int
  window_internal_height (struct window *w)
  {
    int ht = w->total_lines;

    if (!MINI_WINDOW_P (w))
      {
        if (!NILP (w->parent)
            || WINDOWP (w->contents)
            || !NILP (w->next)
            || !NILP (w->prev)
            || window_wants_mode_line (w))
          --ht;

        if (window_wants_header_line (w))
          --ht;
      }

    return ht;
  }

I don't understand any of the conditions except window_wants_mode_line
when we decide whether to decrease the height due to the mode line.
What do the other conditions have to do with the window's height?  I
could perhaps understand the "WINDOWP (w->contents)" part, as some
kind of optimization for non-leaf windows, which assumes the default
of having the mode line, but the rest seem simply wrong, don't they?
(The WINDOWP condition is not really interesting, as I don't see any
call of this function for a non-leaf window.)

This is the immediate cause of bug#33363, which I could fix either by
a local change in try_window_id, or by modifying
window_internal_height to leave only the window_wants_mode_line
condition there.  If the latter might be unsafe, maybe I should do the
former on the release branch and the latter on master.  WDYT?

TIA



reply via email to

[Prev in Thread] Current Thread [Next in Thread]