summaryrefslogtreecommitdiff
path: root/lisp/mail
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2022-11-10 19:16:40 +0200
committerEli Zaretskii <eliz@gnu.org>2022-11-10 19:16:40 +0200
commit702a47f4f6f1f06e5d1c2f472de5c06d47fc38a0 (patch)
treeb1f301075bd046a139c43ea3aab7431b9624d18a /lisp/mail
parentdc4aef3b85f22e5d529c5ceb0686f26781587601 (diff)
downloademacs-702a47f4f6f1f06e5d1c2f472de5c06d47fc38a0.tar.gz
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)
Diffstat (limited to 'lisp/mail')
-rw-r--r--lisp/mail/rmail.el10
1 files 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.