Subject: Re: bug#78957: 31.0.50; Wrong mode-line in fancy diary

From: Manuel Giraud <[email-masked]>
Date: Thu, 10 Jul 2025 17:10:56 +0200

Eli Zaretskii <[email-masked]> writes:

>> From: Manuel Giraud <[email-masked]>
>> Cc: [email-masked], Eli Zaretskii <[email-masked]>
>> Date: Thu, 10 Jul 2025 14:24:00 +0200
>> 
>> Hi Eli,
>> 
>> Do you think this patch could go in?  Maybe in the emacs-30 branch since
>> it is a bug fix?
>
> Is this a regression in a recent Emacs version?  If yes, which
> version?

Hard to tell but it seems it already has been an issue before:

--8<---------------cut here---------------start------------->8---
commit 4cbd0713000c5f0a184e16df3556e8408ea3b894
Author: Mark Oteiza <[email-masked]>
Date:   Sat Oct 10 22:23:59 2015 -0400

    * lisp/calendar/calendar.el: Display buffer before executing body.
    
    In each use of this macro, the modeline is derived from a window width
    calculation, which will be wrong if (display-buffer) splits the window
    horizontally.
--8<---------------cut here---------------end--------------->8---

But at the same time, `calendar-set-mode-line' has not been modified
since 2012.

So maybe, once upon a time, `display-buffer' meant "make this buffer the
selected window" and this is not the case anymore.

> If this isn't a regression, then please make the patch 110% safe if
> you want it to go to the release branch.  E.g., what if
> get-buffer-window returns nil?
>
> Martin, any comments to the patch, with emphasis on its safety?

I'll try and report about Martin's proposal.

Thanks.
-- 
Manuel Giraud