From 1de375f26f38f05f7d2fe4db343dd9e36dbd2bce Mon Sep 17 00:00:00 2001 From: Mark Walters Date: Tue, 7 Aug 2012 16:49:24 +0100 Subject: [PATCH] Re: [PATCH] notmuch-show: add notmuch-show-auto-mark-read option --- 1a/509a55fe9e3c6a3a9b23048c5a94443f90566b | 162 ++++++++++++++++++++++ 1 file changed, 162 insertions(+) create mode 100644 1a/509a55fe9e3c6a3a9b23048c5a94443f90566b diff --git a/1a/509a55fe9e3c6a3a9b23048c5a94443f90566b b/1a/509a55fe9e3c6a3a9b23048c5a94443f90566b new file mode 100644 index 000000000..310f5e124 --- /dev/null +++ b/1a/509a55fe9e3c6a3a9b23048c5a94443f90566b @@ -0,0 +1,162 @@ +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 F1129431FC0 + for ; Tue, 7 Aug 2012 08:49:33 -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 AHAOTNaNXuFM for ; + Tue, 7 Aug 2012 08:49:33 -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 1F4AB431FAF + for ; Tue, 7 Aug 2012 08:49:33 -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 1Sym2F-0000rw-Ca; Tue, 07 Aug 2012 16:49:31 +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 1Sym2F-0001I0-3m; Tue, 07 Aug 2012 16:49:31 +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: +References: + <7c2931eb4d34ff78e4c73d721bc00dc60d185e6a.1344260116.git.mina86@mina86.com> + <874noepwez.fsf@qmul.ac.uk> +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:49:24 +0100 +Message-ID: <87mx26bt2z.fsf@qmul.ac.uk> +MIME-Version: 1.0 +Content-Type: text/plain; charset=utf-8 +Content-Transfer-Encoding: quoted-printable +X-Sender-Host-Address: 94.192.233.223 +X-QM-SPAM-Info: Sender has good ham record. :) +X-QM-Body-MD5: 2fe2388db0178df4e290ea28dcb2462e (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:49:34 -0000 + +On Tue, 07 Aug 2012, Michal Nazarewicz wrote: +>> On Mon, 06 Aug 2012, Michal Nazarewicz wrote: +>>> @@ -1374,9 +1382,11 @@ current thread." +>>> "Are the headers of the current message visible?" +>>> (notmuch-show-get-prop :headers-visible)) +>>>=20=20 +>>> -(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"))) +> +> Mark Walters writes: +>> 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? +> +> Something like the following (not tested)? + +Yes this was what I had in mind. I like this (both the symmetry with +reply tags and the added flexibility) but I will let others +comment. (There is one small bug in your draft: see below) + +Best wishes + +Mark + +> From: Michal Nazarewicz +> Date: Mon, 6 Aug 2012 15:31:20 +0200 +> Subject: [PATCH] notmuch-show: add notmuch-show-mark-read-tags option +> +> The `notmuch-show-mark-read-tags' lists tags that are to be applied when +> message is read. By default, the only value is "-unread" which will remo= +ve +> the unread tag. Among other uses, this variable can be used to stop +> notmuch-show from modifying tags when message is shown (by setting the +> variable to an empty list). +> --- +> emacs/notmuch-show.el | 12 ++++++++++-- +> 1 files changed, 10 insertions(+), 2 deletions(-) +> +> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el +> index dcfc190..92a4beb 100644 +> --- a/emacs/notmuch-show.el +> +++ b/emacs/notmuch-show.el +> @@ -183,6 +183,13 @@ provided with an MLA argument nor `completing-read' = +input." +> notmuch-show-stash-mlarchive-link-alist)) +> :group 'notmuch-show) +>=20=20 +> +(defcustom notmuch-show-mark-read-tags '("-unread") +> + "List of tags to apply when message is read, ie. shown in notmuch-show +> +buffer." +> + :type '(repeat string) +> + :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 +> @@ -1383,8 +1390,9 @@ current thread." +> (notmuch-show-get-prop :headers-visible)) +>=20=20 +> (defun notmuch-show-mark-read () +> - "Mark the current message as read." +> - (notmuch-show-tag-message "-unread")) +> + "Apply `notmuch-show-mark-read-tags' to the message." +> + (when notmuch-show-mark-read-tags +> + (apply notmuch-show-tag-message notmuch-show-mark-read-tags))) + + This needs to be (apply 'notmuch-show-tag-message ...) +>=20=20 +> ;; Functions for getting attributes of several messages in the current +> ;; thread. +> +> --=20 +> Best regards, _ _ +> .o. | Liege of Serenely Enlightened Majesty of o' \,=3D./ `o +> ..o | Computer Science, Micha=C5=82 =E2=80=9Cmina86=E2=80=9D Nazarewicz = + (o o) +> ooo +------------------ooO--(_)--Ooo-- -- 2.26.2