]> git.eshelyaron.com Git - emacs.git/commitdiff
Don't reset the inbox buffer's modified status in Rmail
authorEli Zaretskii <eliz@gnu.org>
Thu, 10 Nov 2022 17:16:40 +0000 (19:16 +0200)
committerEli Zaretskii <eliz@gnu.org>
Thu, 10 Nov 2022 17:16:40 +0000 (19:16 +0200)
* 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

index f095d5e9c08ee825d97066336968b45b63276f4a..e3372a6ff47dc2a2c8ada7948613e89483b7c96c 100644 (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.