From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs 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 Message-ID: <835yfnrtde.fsf@gnu.org> References: Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31793"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 59108@debbugs.gnu.org To: Ken Olum Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Nov 10 11:34:11 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ot4st-00084Y-FA for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 10 Nov 2022 11:34:11 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ot4sm-0003fX-9T; Thu, 10 Nov 2022 05:34:04 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ot4sk-0003cf-K4 for bug-gnu-emacs@gnu.org; Thu, 10 Nov 2022 05:34:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ot4sk-00034v-C2 for bug-gnu-emacs@gnu.org; Thu, 10 Nov 2022 05:34:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ot4sj-00081P-S1 for bug-gnu-emacs@gnu.org; Thu, 10 Nov 2022 05:34:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 10 Nov 2022 10:34:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 59108 X-GNU-PR-Package: emacs Original-Received: via spool by 59108-submit@debbugs.gnu.org id=B59108.166807644030828 (code B ref 59108); Thu, 10 Nov 2022 10:34:01 +0000 Original-Received: (at 59108) by debbugs.gnu.org; 10 Nov 2022 10:34:00 +0000 Original-Received: from localhost ([127.0.0.1]:42023 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ot4sh-000819-EK for submit@debbugs.gnu.org; Thu, 10 Nov 2022 05:33:59 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:55546) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ot4sf-00080t-VC for 59108@debbugs.gnu.org; Thu, 10 Nov 2022 05:33:58 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ot4sZ-0002sT-9m; Thu, 10 Nov 2022 05:33:51 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=mFUxNLBDV76CaS12rvZfE69o6KB0rE5lbc3/VoPK5rk=; b=m4fg4TINAZ5b zfBkeUDQ9G5YGtis34lZ+qrOGsPVqlERqj8j/osrhEMKByEHcyoqcyRxGaMoxHPHzw1RJN+VRlMWU BwAQPfdGKI9b68TQiTPBMIIS+3x8QtMQlT6EYNV4DOospCFggVRnZ6OdvzC480HMV7HkfDLsMjerw OVKY/THWuQoWcOQttI6LDFXdn1a4EIMHx/q66e2zS7COFGx6nwEWiGUwKfkIcFG6Znp0P1GN1T/zC gJISX/ha7eVG4InVE5AQ7QI7w0muR77n0bRqQvPAesmWxrsaiEZkw0vsXrTydZr9OnjEp00tAowwJ hPlbTSxx5uFZHhDz+r8jkA==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ot4sW-0002iE-Qx; Thu, 10 Nov 2022 05:33:50 -0500 In-Reply-To: (message from Ken Olum on Mon, 07 Nov 2022 11:20:20 -0500) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:247506 Archived-At: > From: Ken Olum > 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.