From 972d8eb4ba46777d0dd7f99fd7a04584c003ecc2 Mon Sep 17 00:00:00 2001 From: Mark Walters Date: Tue, 7 Aug 2012 16:13:40 +0100 Subject: [PATCH] Re: [PATCH] notmuch-show: add notmuch-show-auto-mark-read option --- 5b/2e9d03eb1bde4329c3690ca83526eb2c31eb74 | 137 ++++++++++++++++++++++ 1 file changed, 137 insertions(+) create mode 100644 5b/2e9d03eb1bde4329c3690ca83526eb2c31eb74 diff --git a/5b/2e9d03eb1bde4329c3690ca83526eb2c31eb74 b/5b/2e9d03eb1bde4329c3690ca83526eb2c31eb74 new file mode 100644 index 000000000..7355a10d5 --- /dev/null +++ b/5b/2e9d03eb1bde4329c3690ca83526eb2c31eb74 @@ -0,0 +1,137 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id 5579E431FC0 + for ; Tue, 7 Aug 2012 08:13:52 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -1.098 +X-Spam-Level: +X-Spam-Status: No, score=-1.098 tagged_above=-999 required=5 + tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001, + NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id qdBPo6w8ccsT for ; + Tue, 7 Aug 2012 08:13:51 -0700 (PDT) +Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6]) + (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 855D5431FAF + for ; Tue, 7 Aug 2012 08:13:51 -0700 (PDT) +Received: from smtp.qmul.ac.uk ([138.37.6.40]) + by mail2.qmul.ac.uk with esmtp (Exim 4.71) + (envelope-from ) + id 1SylTf-0007rQ-D3; Tue, 07 Aug 2012 16:13:47 +0100 +Received: from 94-192-233-223.zone6.bethere.co.uk ([94.192.233.223] + helo=localhost) + by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.69) + (envelope-from ) + id 1SylTf-0006Bh-3y; Tue, 07 Aug 2012 16:13:47 +0100 +From: Mark Walters +To: Michal Nazarewicz , notmuch@notmuchmail.org +Subject: Re: [PATCH] notmuch-show: add notmuch-show-auto-mark-read option +In-Reply-To: + <7c2931eb4d34ff78e4c73d721bc00dc60d185e6a.1344260116.git.mina86@mina86.com> +References: + <7c2931eb4d34ff78e4c73d721bc00dc60d185e6a.1344260116.git.mina86@mina86.com> +User-Agent: Notmuch/0.13.2+96~g634443c (http://notmuchmail.org) Emacs/23.4.1 + (x86_64-pc-linux-gnu) +Date: Tue, 07 Aug 2012 16:13:40 +0100 +Message-ID: <874noepwez.fsf@qmul.ac.uk> +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Sender-Host-Address: 94.192.233.223 +X-QM-SPAM-Info: Sender has good ham record. :) +X-QM-Body-MD5: 13dee221bff979a4c103cbb06fa6f317 (of first 20000 bytes) +X-SpamAssassin-Score: -1.8 +X-SpamAssassin-SpamBar: - +X-SpamAssassin-Report: The QM spam filters have analysed this message to + determine if it is + spam. We require at least 5.0 points to mark a message as spam. + This message scored -1.8 points. + Summary of the scoring: + * -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, + * medium trust + * [138.37.6.40 listed in list.dnswl.org] + * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail + provider * (markwalters1009[at]gmail.com) + * -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay + * domain + * 0.5 AWL AWL: From: address is in the auto white-list +X-QM-Scan-Virus: ClamAV says the message is clean +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Tue, 07 Aug 2012 15:13:52 -0000 + +On Mon, 06 Aug 2012, Michal Nazarewicz wrote: +> From: Michal Nazarewicz +> +> Setting `notmuch-show-auto-mark-read' to nil stops notmuch-show from marking +> the message as read (by removing the unread tag). Inteded for people who +> like to mark messages read explicitly. +> --- +> emacs/notmuch-show.el | 16 +++++++++++++--- +> 1 files changed, 13 insertions(+), 3 deletions(-) +> +> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el +> index d318430..85a17b1 100644 +> --- a/emacs/notmuch-show.el +> +++ b/emacs/notmuch-show.el +> @@ -183,6 +183,14 @@ provided with an MLA argument nor `completing-read' input." +> notmuch-show-stash-mlarchive-link-alist)) +> :group 'notmuch-show) +> +> +(defcustom notmuch-show-auto-mark-read t +> + "Whether to automatically mark message as read when it is shown. If +> +nil, message needs to be marked as read manually for instance by +> +removing the unread tag." +> + :type 'boolean +> + :group 'notmuch-show) +> + +> + +> (defmacro with-current-notmuch-show-message (&rest body) +> "Evaluate body with current buffer set to the text of current message" +> `(save-excursion +> @@ -1374,9 +1382,11 @@ current thread." +> "Are the headers of the current message visible?" +> (notmuch-show-get-prop :headers-visible)) +> +> -(defun notmuch-show-mark-read () +> - "Mark the current message as read." +> - (notmuch-show-tag-message "-unread")) +> +(defun notmuch-show-mark-read (&optional force) +> + "Mark the current message as read if FORCE or +> +`notmuch-show-auto-mark-read' is non-nil." +> + (when (or force notmuch-show-auto-mark-read) +> + (notmuch-show-tag-message "-unread"))) + + +As an alternative approach would allowing a list of tags (or even tag +changes) to apply when a message is "read" do what you want and be more +flexible? I am thinking of something roughly analogous to +notmuch-message-replied-tags. I can imagine some people would like to +remove the inbox tag automatically for example. (And since we sync with +maildir flags the exact tag name does matter). + + +I agree with Austin that the current unread marking is a little +weird/unpredictable (eg notmuch-show-next-message marks a message read +even if it is closed) but I don't think fixing that helps your use. + +Best wishes + +Mark + + -- 2.26.2