Subject: bug#55286: 29.0.50; Diary problems when switching date styles

From: Stephen Berman <[email-masked]>
Date: Fri, 06 May 2022 10:59:54 +0200

0. With diary-file empty, start Emacs with -Q.
1. Type `M-x calendar', then in the Calendar type `i d', which opens a
   Diary buffer and inserts a date header (in American style).  Type
   'test1' as the diary entry, then `C-x C-s' to save the diary file,
   then `C-x k RET' to kill the Diary buffer.
2. In the Calendar buffer type `d'.  This displays the following in the
   Diary buffer:

   Friday, May 6, 2022
   ===================
   test1

   In the Calendar buffer type `q' to close it and the Diary buffer.
3. Type `M-x calendar-set-date-style RET iso RET'.
4. Type `M-x calendar' and in the Calendar type `i d': this shows the
   Diary with the following content:

   May 6, 2022 test1
   2022-05-06

   Note that the first date is fontified with 'diary' face but the
   second date isn't.  After the second date type 'test2', the `C-x C-s
   C-x k RET' to save and then kill the Diary buffer.
5. In the Calendar buffer type `d'.  This displays the following in the
   Diary buffer:

   2022-05-06
   ==========
   test2
    2022 test1

6. Type `M-x calendar-set-date-style RET' to restore the 'american' date
   style.
7. Type `M-x calendar' and in the Calendar type `i d': this shows the
   Diary with the following content:

   May 6, 2022 test1
   2022-05-06 test2
   May 6, 2022

   The first and third dates are fontified with 'diary' face but the
   second date isn't.  After the third date type 'test3', the `C-x C-s
   C-x k RET' to save and then kill the Diary buffer.
8. In the Calendar buffer type `d'.  This displays the following in the
   Diary buffer:

   Friday, May 6, 2022
   ===================
   test1
   test3

   Note that the second diary item is not displayed.

In GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.33, cairo version 1.17.6)
 of 2022-05-05 built on strobelfs2
Repository revision: 8fce81897dabe9c06f7b3f59cfb0bb9348422531
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12101003
System Description: Linux From Scratch r11.0-165

Configured using:
 'configure --with-xinput2 --with-xwidgets 'CFLAGS=-Og -g3'
 PKG_CONFIG_PATH=/opt/qt5/lib/pkgconfig'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
JSON LCMS2 LIBSYSTEMD LIBXML2 MODULES NOTIFY INOTIFY PDUMPER PNG RSVG
SECCOMP SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS WEBP X11 XDBE XIM
XINPUT2 XPM XWIDGETS GTK3 ZLIB

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix