Subject: bug#38181: Actual height of mode-line not taken into account

From: Carlos Pita <[email-masked]>
Date: Fri, 15 Oct 2021 17:09:16 -0300

Hi Eli,

> "Step 1" being the original recipe of Jonas?  Then what is new about
> this report that Jonas didn't already report and we didn't already
> discuss and analyze?

Perhaps the new steps? I will provide my perspective and the formal
procedure to reproduce the issue one last time. Then I let it up to
you to decide if you have already discussed it because the exact
relationship between what I see and what happens under the hood is way
beyond my knowledge. If after that you still feel that I should file a
new ticket, just let me know and I will gladly do it as a mere automaton.

In message #20 you said:

> Why the need to use advising? Your recipe shows that calling
> redisplay before fit-window-to-buffer also solves the problem.  Can't
> you do something like that only when you add such tall images to the
> mode line?

In message #29:

> Code like 'fit-window-to-buffer' works on the text area
> only, it doesn't care whether a scroll bar or mode line changed size
> since last redisplay.

In message #33:

> If this is to make the mode line prettier, then it should be done
> [calling redisplay] once, at the beginning of a session, right?

In message #39 Martin said:

> If we don't want 'fit-window-to-buffer' to do that always we'd need
> some variable, either buffer local or even a window parameter, that
> 'fit-window-to-buffer' would inspect once and reset immediately in
> order to perform only the redisplay call that's really needed.

There are more examples but I hope you get the gist of it. Moreover,
there is the "conventional" workaround [1] which likely was a
consequence of the discussion above. The advice deliberately
deactivates itself after the first redisplay.

So from what I can see there was some consensus regarding that a
single call to redisplay after changing the modeline geometry would
suffice. Now that's exactly what I am bringing into question here. I
reiterate the recipe:

1. Execute the code.
2. Call test-popup and check that the layout is wrong.
3. Redefine test-popup with (redisplay) uncommented.
4. Call it again and check that the layout is right.
5. Redefine test-popup with (redisplay) commented again.
6. Call it again and check that the layout is wrong again.

Specifically, step 6 contradicts the statement that doing a redisplay
after modifying the modeline geometry is enough.

Now you might say: but then why are you reporting this here, it is
not a modeline issue. To what I would answer: you still need step 1
that involves modifying the modeline. And if you then asked: but
what's new wrt what was already discussed? I would answer exactly like
I'm answering now and we would be going around in circles.
I understand the issue is confusing but sadly I don't know enough about
the subject to make it clearer to you. Maybe I'm not saying anything
new about the internals you already know, but from outside it looks
different.

Best regards,
Carlos

---

[1] https://github.com/tarsius/moody/blob/9b679400ca885b8ff51bcfd75b87f79d66c0ee26/moody.el#L303