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

From: Manuel Giraud <[email-masked]>
Date: Thu, 10 Jul 2025 14:24:00 +0200

Manuel Giraud <[email-masked]> writes:

> Stephen Berman <[email-masked]> writes:
>
> [...]
>
>> I hope you haven't spent time on that yet, because it occurred to me
>> that the following patch might suffice:
>
> :-D I did not spend to much time but, in the mean time, came up with
> this one:
>
>>>From 5b1b04936e5d31197ea5129fb7e56e28f0aa24ad Mon Sep 17 00:00:00 2001
> From: Stephen Berman <[email-masked]>
> Date: Sat, 5 Jul 2025 10:56:00 +0200
> Subject: [PATCH] Fix mode-line string width in diary view
>
> * lisp/calendar/calendar.el (calendar-in-read-only-buffer):
> Select the buffer window because, for example,
> `calendar-set-mode-line' needs it.
> ---
>  lisp/calendar/calendar.el | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/lisp/calendar/calendar.el b/lisp/calendar/calendar.el
> index 917624c489e..8b7aa71db93 100644
> --- a/lisp/calendar/calendar.el
> +++ b/lisp/calendar/calendar.el
> @@ -1168,8 +1168,9 @@ calendar-in-read-only-buffer
>             buffer-undo-list t)
>       (erase-buffer)
>       (display-buffer ,buffer)
> -     ,@body
> -     (goto-char (point-min))
> +     (with-selected-window (get-buffer-window ,buffer)
> +       ,@body
> +       (goto-char (point-min)))
>       (set-buffer-modified-p nil)
>       (setq buffer-read-only t)))
>  
> -- 
> 2.49.0

Hi Eli,

Do you think this patch could go in?  Maybe in the emacs-30 branch since
it is a bug fix?
-- 
Manuel Giraud