On Fri, 04 Jul 2025 21:14:52 +0200 Manuel Giraud wrote: > Hi, > > When viewing diary entry from the calendar, the mode line could be set > erroneously. The recipe: > > - Have a file "/tmp/diary" with the following content: > > July 4, 2025 A bitter day for many > > - emacs -Q > - M-: (setopt diary-file "/tmp/diary") > - M-: (toggle-frame-fullscreen) > - M-: (calendar) > - g d > - 2025 > - July > - 4 > - d > > Observe that the date in the mode line of the diary view buffer is not > centered and maybe partly out of sight. This seems to come from the > fact that the call to `window-edges' in `calendar-set-mode-line' does > not return correct values but I can't figure out why. I think it's because both times `window-edges' is called in `diary-fancy-display' the selected window is the one displaying the Calendar, whose `window-width' is the full screen width due to `toggle-frame-fullscreen', while the window displaying the Fancy Diary is half as wide. The following patch seems to fix the problem for me: