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)
This commit is contained in:
Eli Zaretskii 2022-11-10 19:16:40 +02:00
parent dc4aef3b85
commit 702a47f4f6

View file

@ -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.