Subject: 28.2; rmail-get-new-mail sets unmodified if no new mail even if buffer modified before

From: Ken Olum <[email-masked]>
Date: Mon, 07 Nov 2022 11:20:20 -0500

rmail-get-new-mail-1 sets buffer-modified-p at the beginning to deal
with locking issues right away.  Then if there is no new mail it clears
buffer-modified-p.  Thus if the buffer was modified already it gets
marked unmodified without being saved.

I think it should restore buffer-modified-p to whatever it was to begin
with when it doesn't find any new mail.  I'll send a patch if you like.

To reproduce:

emacs -Q
M-x rmail
Delete a message or make some other change.  Buffer now marked modified.
Without having any new mail, press "g".
Get message "0 new messages read".  Buffer now marked unmodified.

                                        Ken

In GNU Emacs 28.2 (build 1, x86_64-pc-linux-gnu, X toolkit, Xaw scroll bars)
 of 2022-11-07 built on cosmos
Windowing system distributor 'The X.Org Foundation', version 11.0.11906000
System Description: Ubuntu 18.04.6 LTS

Configured features:
FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG LIBXML2 MODULES
NOTIFY INOTIFY PDUMPER PNG SECCOMP SOUND THREADS TIFF
TOOLKIT_SCROLL_BARS X11 XDBE XFT XIM XPM LUCID ZLIB

Important settings:
  value of $LC_ALL: C
  value of $LANG: en_US.UTF-8
  locale-coding-system: nil

Major mode: RMAIL

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug sendmail shr-color color shr kinsoku svg
xml dom browse-url url url-proxy url-privacy url-expand url-methods
url-history url-cookie url-domsuf url-util url-parse url-vars mailcap
rmailmm message rmc puny dired dired-loaddefs rfc822 mml mml-sec epa
derived epg rfc6068 epg-config gnus-util text-property-search time-date
mm-decode mm-bodies mm-encode mailabbrev gmm-utils mailheader mail-parse
rfc2231 rmail rmail-loaddefs auth-source cl-seq eieio eieio-core cl-macs
eieio-loaddefs cl-loaddefs cl-lib password-cache json subr-x map seq
byte-opt gv bytecomp byte-compile cconv rfc2047 rfc2045 ietf-drums
mm-util mail-prsvr mail-utils iso-transl tooltip eldoc paren electric
uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel
term/x-win x-win term/common-win x-dnd tool-bar dnd fontset image
regexp-opt fringe tabulated-list replace newcomment text-mode lisp-mode
prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu
timer select scroll-bar mouse jit-lock font-lock syntax font-core
term/tty-colors frame minibuffer cl-generic cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms
cp51932 hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese composite emoji-zwj charscript charprop case-table
epa-hook jka-cmpr-hook help simple abbrev obarray cl-preloaded nadvice
button loaddefs faces cus-face macroexp files window text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote threads inotify dynamic-setting
system-font-setting font-render-setting x-toolkit x multi-tty
make-network-process emacs)

Memory information:
((conses 16 61191 13369)
 (symbols 48 7588 1)
 (strings 32 23283 2385)
 (string-bytes 1 722945)
 (vectors 16 14763)
 (vector-slots 8 204330 17922)
 (floats 8 135 324)
 (intervals 56 334 0)
 (buffers 992 12))