From 702a47f4f6f1f06e5d1c2f472de5c06d47fc38a0 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Thu, 10 Nov 2022 19:16:40 +0200 Subject: [PATCH] Don't reset the inbox buffer's modified status in Rmail * lisp/mail/rmail.el (rmail-get-new-mail-1): Don't mark the buffer unmodified if it was modified before getting new mail. (Bug#59108) --- lisp/mail/rmail.el | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el index f095d5e9c08..e3372a6ff47 100644 --- a/lisp/mail/rmail.el +++ b/lisp/mail/rmail.el @@ -1751,6 +1751,7 @@ not be a new one). It returns non-nil if it got any new messages." (spam-filter-p (and (featurep 'rmail-spam-filter) rmail-use-spam-filter)) (blurb "") + (mod-p (buffer-modified-p)) result success suffix) (narrow-to-region (point) (point)) ;; Read in the contents of the inbox files, renaming them as @@ -1766,10 +1767,11 @@ not be a new one). It returns non-nil if it got any new messages." (rmail-insert-inbox-text files nil) (setq delete-files (rmail-insert-inbox-text files t)))) ;; If there was no new mail, or we aborted before actually - ;; trying to get any, mark buffer unmodified. Otherwise the - ;; buffer is correctly marked modified and the file locked - ;; until we save out the new mail. - (if (= (point-min) (point-max)) + ;; trying to get any, mark buffer unmodified, unless it was + ;; modified originally. Otherwise the buffer is correctly + ;; marked modified and the file locked until we save out the + ;; new mail. + (if (and (null mod-p) (= (point-min) (point-max))) (set-buffer-modified-p nil))) ;; Scan the new text and convert each message to ;; Rmail/mbox format. -- 2.39.5