Subject: 29.1.90; Buffer's modified flag remains after undoing

From: Óscar Fuentes <[email-masked]>
Date: Sun, 19 Nov 2023 03:10:21 +0100

$ emacs -Q xdisp.c

Highlight a region with C-SPC <cursor down>

M-x comment-region

M-x undo

The change is undone, but the buffer is still marked as modified.

In GNU Emacs 29.1.90 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo
 version 1.18.0) of 2023-11-18 built on sky
Repository revision: da946ca6924b5ba1a1c785284406cf894aef12b5
Repository branch: emacs-29
Windowing system distributor 'The X.Org Foundation', version 11.0.12101009
System Description: Debian GNU/Linux trixie/sid

Configured using:
 'configure --with-native-compilation --without-toolkit-scroll-bars
 --with-x-toolkit=lucid --with-modules --without-imagemagick'

Configured features:
CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG JSON
LIBOTF LIBSELINUX LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG
RSVG SECCOMP SOUND THREADS TIFF TREE_SITTER WEBP X11 XAW3D XDBE XIM
XINPUT2 XPM LUCID ZLIB

Important settings:
  value of $LANG: C
  locale-coding-system: nil