From: Eli Zaretskii <eliz@gnu.org>
To: Ken Olum <kdo@cosmos.phy.tufts.edu>
Cc: 59108@debbugs.gnu.org
Subject: bug#59108: 28.2; rmail-get-new-mail sets unmodified if no new mail even if buffer modified before
Date: Thu, 10 Nov 2022 12:33:49 +0200 [thread overview]
Message-ID: <835yfnrtde.fsf@gnu.org> (raw)
In-Reply-To: <q52cz9ywxbv.fsf@cosmos.phy.tufts.edu> (message from Ken Olum on Mon, 07 Nov 2022 11:20:20 -0500)
> From: Ken Olum <kdo@cosmos.phy.tufts.edu>
> 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.
Thanks. Does the patch below give good results?
diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el
index f095d5e..e3372a6 100644
--- a/lisp/mail/rmail.el
+++ b/lisp/mail/rmail.el
@@ -1751,6 +1751,7 @@ rmail-get-new-mail-1
(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 @@ rmail-get-new-mail-1
(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.
next prev parent reply other threads:[~2022-11-10 10:33 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-07 16:20 bug#59108: 28.2; rmail-get-new-mail sets unmodified if no new mail even if buffer modified before Ken Olum
2022-11-10 10:33 ` Eli Zaretskii [this message]
2022-11-10 16:23 ` Ken Olum
2022-11-10 17:18 ` Eli Zaretskii
2022-11-10 17:24 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=835yfnrtde.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=59108@debbugs.gnu.org \
--cc=kdo@cosmos.phy.tufts.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.