From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: "Andrea G. Monaco" Newsgroups: gmane.emacs.bugs Subject: bug#45941: [PATCH] add option to mark buffer as modified after reading new message Date: Wed, 27 Jan 2021 16:40:46 +0100 Message-ID: <8735ymwfpd.fsf@autistici.org> References: <87h7nfbg7k.fsf@autistici.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="3060"; mail-complaints-to="usenet@ciao.gmane.io" To: 45941@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Jan 27 16:43:26 2021 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 1l4myb-0000hJ-UU for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 27 Jan 2021 16:43:26 +0100 Original-Received: from localhost ([::1]:55424 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l4mya-0003ED-QW for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 27 Jan 2021 10:43:25 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:39692) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l4mxG-0002br-1J for bug-gnu-emacs@gnu.org; Wed, 27 Jan 2021 10:42:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:34295) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l4mxF-00015e-O7 for bug-gnu-emacs@gnu.org; Wed, 27 Jan 2021 10:42:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1l4mxF-0007rq-LU for bug-gnu-emacs@gnu.org; Wed, 27 Jan 2021 10:42:01 -0500 X-Loop: help-debbugs@gnu.org In-Reply-To: <87h7nfbg7k.fsf@autistici.org> Resent-From: "Andrea G. Monaco" Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 27 Jan 2021 15:42:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 45941 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.161176206430158 (code B ref -1); Wed, 27 Jan 2021 15:42:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 27 Jan 2021 15:41:04 +0000 Original-Received: from localhost ([127.0.0.1]:45841 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l4mwK-0007qM-HY for submit@debbugs.gnu.org; Wed, 27 Jan 2021 10:41:04 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:47448) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l4mwJ-0007qD-6d for submit@debbugs.gnu.org; Wed, 27 Jan 2021 10:41:03 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:39470) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l4mwI-0002CK-P0 for bug-gnu-emacs@gnu.org; Wed, 27 Jan 2021 10:41:02 -0500 Original-Received: from confino.investici.org ([212.103.72.250]:41671) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l4mwG-0000sr-HK for bug-gnu-emacs@gnu.org; Wed, 27 Jan 2021 10:41:02 -0500 Original-Received: from mx1.investici.org (unknown [127.0.0.1]) by confino.investici.org (Postfix) with ESMTP id 4DQnr01t7Yz12th for ; Wed, 27 Jan 2021 15:40:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org; s=stigmate; t=1611762048; bh=BBPrRu5Yq1h7tYfOUESeK/sVXe2C/omXxYysRmhJsDs=; h=From:To:Subject:Date:From; b=DCMSZwJQqx95lWUbW7FDwvGfjWc/NQlV0tVct+sjWWuDVC+buWCek2evUQhjEZaIX 52c9jMADbD6g0BeawlpWmBRM7u26D4R4nr9NyozVLzP1JIHInbsCUdh4XwpctBtRRW NU6ixW5/zdV+Jh+Qqb6GrXhZGO/6zEzkf1Cbwlps= Original-Received: from [212.103.72.250] (mx1.investici.org [212.103.72.250]) (Authenticated sender: andrea.monaco@autistici.org) by localhost (Postfix) with ESMTPSA id 4DQnr019tPz12sl for ; Wed, 27 Jan 2021 15:40:48 +0000 (UTC) Received-SPF: pass client-ip=212.103.72.250; envelope-from=andrea.monaco@autistici.org; helo=confino.investici.org X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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" Xref: news.gmane.io gmane.emacs.bugs:198696 Archived-At: 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