bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#45941: [PATCH] add option to mark buffer as modified after reading n


From: Andrea G. Monaco
Subject: bug#45941: [PATCH] add option to mark buffer as modified after reading new message
Date: Wed, 27 Jan 2021 16:40:46 +0100

Hello,


this patch from current rmail.el adds an option for marking buffer as
modified when a message is read for the first time. The variable defaults
to nil, so it should not change current behavior.


diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el
index 29460cc20f..d800dce671 100644
--- a/lisp/mail/rmail.el
+++ b/lisp/mail/rmail.el
@@ -686,6 +686,10 @@ 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-read-new-message-trigger-modified nil
+  "If true, reading a message for the first time and thus clearing
+its unseen attribute triggers 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 +2751,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-read-new-message-trigger-modified is t
+        (let ((modiff (buffer-modified-p)))
          (rmail-set-attribute rmail-unseen-attr-index nil)
-         (unless modiff
+         (unless rmail-read-new-message-trigger-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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]