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

From: Manuel Giraud <[email-masked]>
Date: Fri, 11 Jul 2025 13:51:07 +0200

Eli Zaretskii <[email-masked]> writes:

>> From: Manuel Giraud <[email-masked]>
>> Cc: martin rudalics <[email-masked]>,  [email-masked],
>>   [email-masked]
>> Date: Thu, 10 Jul 2025 17:10:56 +0200
>> 
>> > 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.
>
> No, display-buffer never selected the window.  Its doc string always
> said that.

Ok.  So maybe, the patch 4cbd07130 was working by chance because the
calendar window was already splitted at correct width.
-- 
Manuel Giraud