From 6a6997307f2fcc653fc61a7eb929ae1db543b9a8 Mon Sep 17 00:00:00 2001 From: Michal Nazarewicz Date: Tue, 7 Aug 2012 17:32:51 +0200 Subject: [PATCH] Re: [PATCH] notmuch-show: add notmuch-show-auto-mark-read option --- 9d/0281ab9c27cb9037e3ba0473a0dc47b10c05d6 | 193 ++++++++++++++++++++++ 1 file changed, 193 insertions(+) create mode 100644 9d/0281ab9c27cb9037e3ba0473a0dc47b10c05d6 diff --git a/9d/0281ab9c27cb9037e3ba0473a0dc47b10c05d6 b/9d/0281ab9c27cb9037e3ba0473a0dc47b10c05d6 new file mode 100644 index 000000000..b7b115aa5 --- /dev/null +++ b/9d/0281ab9c27cb9037e3ba0473a0dc47b10c05d6 @@ -0,0 +1,193 @@ +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 906BC431FAF + for ; Tue, 7 Aug 2012 08:33:01 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -0.8 +X-Spam-Level: +X-Spam-Status: No, score=-0.8 tagged_above=-999 required=5 + tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, + RCVD_IN_DNSWL_LOW=-0.7] 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 9hJQdzae+hkE for ; + Tue, 7 Aug 2012 08:33:01 -0700 (PDT) +Received: from mail-ey0-f181.google.com (mail-ey0-f181.google.com + [209.85.215.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 95722431FC0 + for ; Tue, 7 Aug 2012 08:33:00 -0700 (PDT) +Received: by eaan10 with SMTP id n10so1677000eaa.26 + for ; Tue, 07 Aug 2012 08:32:59 -0700 (PDT) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; + s=20120113; h=from:to:subject:in-reply-to:organization:references:user-agent + :x-face:face:x-pgp:x-pgp-fp:date:message-id:mime-version :content-type; + bh=h0qdZrSUM/RogwqMFIUqgVQsmoSrh/I+oDAD+IVK9b0=; + b=HQ//FTpJy3lyE5QXKAifMpOxtrD/PcwZ5iFJN2pBxY1Tb9Rdbx5gvPzawB/jhq8IIN + 72XoO3qu1haZay9IW6scaNO54bbLqbGYHt8lFsD6lX9QzCZpRh+KHPEm1GJ+Mxj6AmFk + RzLO+KWtfc/Hcvn5URJJMvS8z2vTuwQ4Llszr8cUqFiSKg1kva56P5VSJ13cRTSDGtqY + SWqdgKwdQR44rJgGwOmYII1AbomiqSZ3oK6WYjpi4PdJZoZqANeMPPCRzVuFGotnchUa + fWDunpdlo/plKpArjykExQpJCtGrPpCFiiAc5rr+bWZ3J0g1TFLqcw946mYRTZ3RG5Hq XR6Q== +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=google.com; s=20120113; + h=from:to:subject:in-reply-to:organization:references:user-agent + :x-face:face:x-pgp:x-pgp-fp:date:message-id:mime-version + :content-type:x-gm-message-state; + bh=h0qdZrSUM/RogwqMFIUqgVQsmoSrh/I+oDAD+IVK9b0=; + b=mxznAuSVvppeF8UDMKSjxv6baideAcVbZHWgQBCbcxWwRvGVv1FBY1Sjj5DbngQRQZ + XbM0mMabB7cDIeMPIs3fgZwdeciEf64fhIKy2E4NBzxbgE1laC3kmQAYU1FThqa+/I8z + stNIf1V+L2GQ4NXnNFulkVFl0Fcb7UOJYyKmW6joda/7+vH8F4b7PaoLHbaNROcF1GBW + bF6Uj/2VPgcrIKL13SUqmKx/UZVlj9xk8typKVHmeeNN9BuvjG7DBGJtfAsB0S5wxgB7 + iRdlhVIYHR60kL0QTaJ4+MGo+Y1AJGe6kfG8NdXEK2xnz6OSBEfZtA8BphVeOJowB9Ck + Hjfw== +Received: by 10.14.0.198 with SMTP id 46mr12102637eeb.30.1344353579021; + Tue, 07 Aug 2012 08:32:59 -0700 (PDT) +Received: by 10.14.0.198 with SMTP id 46mr12102622eeb.30.1344353578872; + Tue, 07 Aug 2012 08:32:58 -0700 (PDT) +Received: from mpn-glaptop ([2620:0:105f:5:f2de:f1ff:fe35:1a72]) + by mx.google.com with ESMTPS id g46sm56872806eep.15.2012.08.07.08.32.57 + (version=TLSv1/SSLv3 cipher=OTHER); + Tue, 07 Aug 2012 08:32:57 -0700 (PDT) +From: Michal Nazarewicz +To: Mark Walters , notmuch@notmuchmail.org +Subject: Re: [PATCH] notmuch-show: add notmuch-show-auto-mark-read option +In-Reply-To: <874noepwez.fsf@qmul.ac.uk> +Organization: Google Inc +References: + <7c2931eb4d34ff78e4c73d721bc00dc60d185e6a.1344260116.git.mina86@mina86.com> + <874noepwez.fsf@qmul.ac.uk> +User-Agent: Notmuch/0.13.2 (http://notmuchmail.org) Emacs/24.1.50.2 + (x86_64-unknown-linux-gnu) +X-Face: PbkBB1w#)bOqd`iCe"Ds{e+!C7`pkC9a|f)Qo^BMQvy\q5x3?vDQJeN(DS?|-^$uMti[3D*#^_Ts"pU$jBQLq~Ud6iNwAw_r_o_4]|JO?]}P_}Nc&"p#D(ZgUb4uCNPe7~a[DbPG0T~!&c.y$Ur,=N4RT>]dNpd; KFrfMCylc}gc??'U2j,!8%xdD +Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAJFBMVEWbfGlUPDDHgE57V0jUupKjgIObY0PLrom9mH4dFRK4gmjPs41MxjOgAAACQElEQVQ4jW3TMWvbQBQHcBk1xE6WyALX1069oZBMlq+ouUwpEQQ6uRjttkWP4CmBgGM0BQLBdPFZYPsyFUo6uEtKDQ7oy/U96XR2Ux8ehH/89Z6enqxBcS7Lg81jmSuujrfCZcLI/TYYvbGj+jbgFpHJ/bqQAUISj8iLyu4LuFHJTosxsucO4jSDNE0Hq3hwK/ceQ5sx97b8LcUDsILfk+ovHkOIsMbBfg43VuQ5Ln9YAGCkUdKJoXR9EclFBhixy3EGVz1K6eEkhxCAkeMMnqoAhAKwhoUJkDrCqvbecaYINlFKSRS1i12VKH1XpUd4qxL876EkMcDvHj3s5RBajHHMlA5iK32e0C7VgG0RlzFPvoYHZLRmAC0BmNcBruhkE0KsMsbEc62ZwUJDxWUdMsMhVqovoT96i/DnX/ASvz/6hbCabELLk/6FF/8PNpPCGqcZTGFcBhhAaZZDbQPaAB3+KrWWy2XgbYDNIinkdWAFcCpraDE/knwe5DBqGmgzESl1p2E4MWAz0VUPgYYzmfWb9yS4vCvgsxJriNTHoIBz5YteBvg+VGISQWUqhMiByPIPpygeDBE6elD973xWwKkEiHZAHKjhuPsFnBuArrzxtakRcISv+XMIPl4aGBUJm8Emk7qBYU8IlgNEIpiJhk/No24jHwkKTFHDWfPniR4iw5vJaw2nzSjfq2zffcE/GDjRC2dn0J0XwPAbDL84TvaFCJEU4Oml9pRyEUhR3Cl2t01AoEjRbs0sYugp14/4X5n4pU4EHHnMAAAAAElFTkSuQmCC +X-PGP: 50751FF4 +X-PGP-FP: AC1F 5F5C D418 88F8 CC84 5858 2060 4012 5075 1FF4 +Date: Tue, 07 Aug 2012 17:32:51 +0200 +Message-ID: +MIME-Version: 1.0 +Content-Type: multipart/mixed; boundary="=-=-=" +X-Gm-Message-State: ALoCoQkoy9It0Ej6FwXJBwKhNPviFGvrbAS57KwlCTLvZHtUn9rIS1wY/ypzQyF663ZybeEecv1fU6zsM4SIhuUqskitKkzxdeFGa7gv5dEiPChDfXbQNiIf/HLz0eG8NKleSz/hHvdLLqlPjrmikaGMmNfMNLXaP46iAY2q4+2R4FmR24FygElcF/2Q99+93mlqgnQhJh5YyEbYpxP68qvv21CghA9vMw== +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:33:02 -0000 + +--=-=-= +Content-Type: text/plain; charset=utf-8 +Content-Transfer-Encoding: quoted-printable + +> 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)? + +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 remove +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' in= +put." + notmuch-show-stash-mlarchive-link-alist)) + :group 'notmuch-show) +=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 + (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))) +=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-- +--=-=-= +Content-Type: multipart/signed; boundary="==-=-="; + micalg=pgp-sha1; protocol="application/pgp-signature" + +--==-=-= +Content-Type: text/plain + + +--==-=-= +Content-Type: application/pgp-signature + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.10 (GNU/Linux) + +iQIcBAEBAgAGBQJQITUjAAoJECBgQBJQdR/0sW8P/jSm5/kLi+NroL9AMFuZ46td +dF7PkkzxfjF40Zh/pYR4ismd7VXtj37o89AAp3KNOz5CKu6KtSu692E2BDEV3fWU +eVsXj4qk3yEEs+E82WihuECu5LgBNFcQWAoc+2Fj0ct8isI9HuLF9Onj8e0jLgaY +oOSoUnzCyB5Ga+O5QaM1JgYECV9nIfAibqf+6rhp8+6oZAHYTA5cJdXzDcGhB7V9 +d4Fw3/OYQqevMk1HIk27wt5zh322VMTmOaZrcNM8CwwaBttPGgmalcMf4cPTMo/4 +v7eCX+gaGMCbj691wKwmmz0UfVgQLfJYrugbgAJZkx0jRvSexBa1+JX8kVJqpAbG +d98Kph8GTHJ7BXw62RLHFTPo8KKP7VzT0WNJ4bYA0QAEU6akLYORtkOUrYtYS4/F +1LK9tICnEvASQlPEcZXx7mh5EaeTuzcKT+ML/Rn0rPVoC8TGybSzrU0B1onNfkBF +79yMql/+Q1DQvw7YY7jYzAQL39u8FKVSVLVt5tHkk64D5+14TneaKZ2J+Fz1tHF/ +oZjzvFyWz1Emdh2EiN1UkhyAs57nVIGnQCKoQxoCaB/ZD+XIOYfVuMaP5jnw5O+v +AuP0w3/R2KKvS3eaqFM2dbgviXf1kIjECqhpy73OBLYzhY0kvklYYa0elDcAB3kG +sPAUSa7zu5o67xgyZLMj +=db9A +-----END PGP SIGNATURE----- +--==-=-=-- + +--=-=-=-- -- 2.26.2