unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Andrea G. Monaco" <andrea.monaco@autistici.org>
To: 45941@debbugs.gnu.org
Subject: bug#45941: [PATCH] add option to mark buffer as modified after reading new message
Date: Wed, 27 Jan 2021 18:47:06 +0100	[thread overview]
Message-ID: <87zh0uuvad.fsf@autistici.org> (raw)
In-Reply-To: <87h7nfbg7k.fsf@autistici.org>


  > The first line of the docstring should be a complete sentence.
  > Andreas.

Thanks, I didn't know that. I fixed it and also chose a more fitting
name for the variable.


diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el
index 29460cc20f..749cdd5891 100644
--- a/lisp/mail/rmail.el
+++ b/lisp/mail/rmail.el
@@ -686,6 +686,9 @@ rmail-show-mime-function
 This function is called when `rmail-enable-mime' is non-nil.
 The package providing MIME support should set this.")
 
+(defvar rmail-showing-new-message-sets-modified nil
+  "If non-nil, showing a new message sets the modified flag for the RMAIL buffer.")
+
 ;;;###autoload
 (defvar rmail-insert-mime-forwarded-message-function nil
   "Function to insert a message in MIME format so it can be forwarded.
@@ -2747,10 +2750,11 @@ rmail-show-message-1
            (t (setq rmail-current-message msg)))
       (with-current-buffer rmail-buffer
        (setq header-style rmail-header-style)
-       ;; Mark the message as seen, but preserve buffer modified flag.
-       (let ((modiff (buffer-modified-p)))
+        ;; Mark the message as seen, but preserve buffer modified flag,
+       ;; unless rmail-showing-new-message-sets-modified is non-nil
+        (let ((modiff (buffer-modified-p)))
          (rmail-set-attribute rmail-unseen-attr-index nil)
-         (unless modiff
+         (unless rmail-showing-new-message-sets-modified
            (restore-buffer-modified-p modiff)))
        ;; bracket the message in the mail
        ;; buffer and determine the coding system the transfer encoding.


-- 
Andrea G. Monaco
Hacker, mathematician, lgbt+ activist
"Hope will never be silent!", H. Milk





  parent reply	other threads:[~2021-01-27 17:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-17 17:55 bug#45941: 28.0.50; rmail doesn't set modified flag when changing 'unseen' flag Andrea G. Monaco
2021-01-27 15:40 ` bug#45941: [PATCH] add option to mark buffer as modified after reading new message Andrea G. Monaco
2021-01-27 15:53   ` Andreas Schwab
2021-01-27 17:47 ` Andrea G. Monaco [this message]
2021-01-30  9:28   ` 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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zh0uuvad.fsf@autistici.org \
    --to=andrea.monaco@autistici.org \
    --cc=45941@debbugs.gnu.org \
    /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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).