Re: [PATCH] notmuch-show: add notmuch-show-auto-mark-read option
authorMichal Nazarewicz <mpn@google.com>
Tue, 7 Aug 2012 15:32:51 +0000 (17:32 +0200)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:48:56 +0000 (09:48 -0800)
9d/0281ab9c27cb9037e3ba0473a0dc47b10c05d6 [new file with mode: 0644]

diff --git a/9d/0281ab9c27cb9037e3ba0473a0dc47b10c05d6 b/9d/0281ab9c27cb9037e3ba0473a0dc47b10c05d6
new file mode 100644 (file)
index 0000000..b7b115a
--- /dev/null
@@ -0,0 +1,193 @@
+Return-Path: <mpn@google.com>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 906BC431FAF\r
+       for <notmuch@notmuchmail.org>; Tue,  7 Aug 2012 08:33:01 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.8\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.8 tagged_above=-999 required=5\r
+       tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+       RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id 9hJQdzae+hkE for <notmuch@notmuchmail.org>;\r
+       Tue,  7 Aug 2012 08:33:01 -0700 (PDT)\r
+Received: from mail-ey0-f181.google.com (mail-ey0-f181.google.com\r
+       [209.85.215.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 95722431FC0\r
+       for <notmuch@notmuchmail.org>; Tue,  7 Aug 2012 08:33:00 -0700 (PDT)\r
+Received: by eaan10 with SMTP id n10so1677000eaa.26\r
+       for <notmuch@notmuchmail.org>; Tue, 07 Aug 2012 08:32:59 -0700 (PDT)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;\r
+ s=20120113;   h=from:to:subject:in-reply-to:organization:references:user-agent\r
+       :x-face:face:x-pgp:x-pgp-fp:date:message-id:mime-version        :content-type;\r
+ bh=h0qdZrSUM/RogwqMFIUqgVQsmoSrh/I+oDAD+IVK9b0=;\r
+       b=HQ//FTpJy3lyE5QXKAifMpOxtrD/PcwZ5iFJN2pBxY1Tb9Rdbx5gvPzawB/jhq8IIN\r
+       72XoO3qu1haZay9IW6scaNO54bbLqbGYHt8lFsD6lX9QzCZpRh+KHPEm1GJ+Mxj6AmFk\r
+       RzLO+KWtfc/Hcvn5URJJMvS8z2vTuwQ4Llszr8cUqFiSKg1kva56P5VSJ13cRTSDGtqY\r
+       SWqdgKwdQR44rJgGwOmYII1AbomiqSZ3oK6WYjpi4PdJZoZqANeMPPCRzVuFGotnchUa\r
+       fWDunpdlo/plKpArjykExQpJCtGrPpCFiiAc5rr+bWZ3J0g1TFLqcw946mYRTZ3RG5Hq    XR6Q==\r
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
+       d=google.com; s=20120113;\r
+       h=from:to:subject:in-reply-to:organization:references:user-agent\r
+       :x-face:face:x-pgp:x-pgp-fp:date:message-id:mime-version\r
+       :content-type:x-gm-message-state;\r
+       bh=h0qdZrSUM/RogwqMFIUqgVQsmoSrh/I+oDAD+IVK9b0=;\r
+       b=mxznAuSVvppeF8UDMKSjxv6baideAcVbZHWgQBCbcxWwRvGVv1FBY1Sjj5DbngQRQZ\r
+       XbM0mMabB7cDIeMPIs3fgZwdeciEf64fhIKy2E4NBzxbgE1laC3kmQAYU1FThqa+/I8z\r
+       stNIf1V+L2GQ4NXnNFulkVFl0Fcb7UOJYyKmW6joda/7+vH8F4b7PaoLHbaNROcF1GBW\r
+       bF6Uj/2VPgcrIKL13SUqmKx/UZVlj9xk8typKVHmeeNN9BuvjG7DBGJtfAsB0S5wxgB7\r
+       iRdlhVIYHR60kL0QTaJ4+MGo+Y1AJGe6kfG8NdXEK2xnz6OSBEfZtA8BphVeOJowB9Ck\r
+       Hjfw==\r
+Received: by 10.14.0.198 with SMTP id 46mr12102637eeb.30.1344353579021;\r
+       Tue, 07 Aug 2012 08:32:59 -0700 (PDT)\r
+Received: by 10.14.0.198 with SMTP id 46mr12102622eeb.30.1344353578872;\r
+       Tue, 07 Aug 2012 08:32:58 -0700 (PDT)\r
+Received: from mpn-glaptop ([2620:0:105f:5:f2de:f1ff:fe35:1a72])\r
+       by mx.google.com with ESMTPS id g46sm56872806eep.15.2012.08.07.08.32.57\r
+       (version=TLSv1/SSLv3 cipher=OTHER);\r
+       Tue, 07 Aug 2012 08:32:57 -0700 (PDT)\r
+From: Michal Nazarewicz <mpn@google.com>\r
+To: Mark Walters <markwalters1009@gmail.com>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH] notmuch-show: add notmuch-show-auto-mark-read option\r
+In-Reply-To: <874noepwez.fsf@qmul.ac.uk>\r
+Organization: Google Inc\r
+References:\r
+ <7c2931eb4d34ff78e4c73d721bc00dc60d185e6a.1344260116.git.mina86@mina86.com>\r
+       <874noepwez.fsf@qmul.ac.uk>\r
+User-Agent: Notmuch/0.13.2 (http://notmuchmail.org) Emacs/24.1.50.2\r
+       (x86_64-unknown-linux-gnu)\r
+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\r
+Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAJFBMVEWbfGlUPDDHgE57V0jUupKjgIObY0PLrom9mH4dFRK4gmjPs41MxjOgAAACQElEQVQ4jW3TMWvbQBQHcBk1xE6WyALX1069oZBMlq+ouUwpEQQ6uRjttkWP4CmBgGM0BQLBdPFZYPsyFUo6uEtKDQ7oy/U96XR2Ux8ehH/89Z6enqxBcS7Lg81jmSuujrfCZcLI/TYYvbGj+jbgFpHJ/bqQAUISj8iLyu4LuFHJTosxsucO4jSDNE0Hq3hwK/ceQ5sx97b8LcUDsILfk+ovHkOIsMbBfg43VuQ5Ln9YAGCkUdKJoXR9EclFBhixy3EGVz1K6eEkhxCAkeMMnqoAhAKwhoUJkDrCqvbecaYINlFKSRS1i12VKH1XpUd4qxL876EkMcDvHj3s5RBajHHMlA5iK32e0C7VgG0RlzFPvoYHZLRmAC0BmNcBruhkE0KsMsbEc62ZwUJDxWUdMsMhVqovoT96i/DnX/ASvz/6hbCabELLk/6FF/8PNpPCGqcZTGFcBhhAaZZDbQPaAB3+KrWWy2XgbYDNIinkdWAFcCpraDE/knwe5DBqGmgzESl1p2E4MWAz0VUPgYYzmfWb9yS4vCvgsxJriNTHoIBz5YteBvg+VGISQWUqhMiByPIPpygeDBE6elD973xWwKkEiHZAHKjhuPsFnBuArrzxtakRcISv+XMIPl4aGBUJm8Emk7qBYU8IlgNEIpiJhk/No24jHwkKTFHDWfPniR4iw5vJaw2nzSjfq2zffcE/GDjRC2dn0J0XwPAbDL84TvaFCJEU4Oml9pRyEUhR3Cl2t01AoEjRbs0sYugp14/4X5n4pU4EHHnMAAAAAElFTkSuQmCC\r
+X-PGP: 50751FF4\r
+X-PGP-FP: AC1F 5F5C D418 88F8 CC84 5858 2060 4012 5075 1FF4\r
+Date: Tue, 07 Aug 2012 17:32:51 +0200\r
+Message-ID: <xa1tpq72d8f0.fsf@mina86.com>\r
+MIME-Version: 1.0\r
+Content-Type: multipart/mixed; boundary="=-=-="\r
+X-Gm-Message-State: ALoCoQkoy9It0Ej6FwXJBwKhNPviFGvrbAS57KwlCTLvZHtUn9rIS1wY/ypzQyF663ZybeEecv1fU6zsM4SIhuUqskitKkzxdeFGa7gv5dEiPChDfXbQNiIf/HLz0eG8NKleSz/hHvdLLqlPjrmikaGMmNfMNLXaP46iAY2q4+2R4FmR24FygElcF/2Q99+93mlqgnQhJh5YyEbYpxP68qvv21CghA9vMw==\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Tue, 07 Aug 2012 15:33:02 -0000\r
+\r
+--=-=-=\r
+Content-Type: text/plain; charset=utf-8\r
+Content-Transfer-Encoding: quoted-printable\r
+\r
+> On Mon, 06 Aug 2012, Michal Nazarewicz <mpn@google.com> wrote:\r
+>> @@ -1374,9 +1382,11 @@ current thread."\r
+>>    "Are the headers of the current message visible?"\r
+>>    (notmuch-show-get-prop :headers-visible))\r
+>>=20=20\r
+>> -(defun notmuch-show-mark-read ()\r
+>> -  "Mark the current message as read."\r
+>> -  (notmuch-show-tag-message "-unread"))\r
+>> +(defun notmuch-show-mark-read (&optional force)\r
+>> +  "Mark the current message as read if FORCE or\r
+>> +`notmuch-show-auto-mark-read' is non-nil."\r
+>> +  (when (or force notmuch-show-auto-mark-read)\r
+>> +    (notmuch-show-tag-message "-unread")))\r
+\r
+Mark Walters <markwalters1009@gmail.com> writes:\r
+> As an alternative approach would allowing a list of tags (or even tag\r
+> changes) to apply when a message is "read" do what you want and be more\r
+> flexible?\r
+\r
+Something like the following (not tested)?\r
+\r
+From: Michal Nazarewicz <mina86@mina86.com>\r
+Date: Mon, 6 Aug 2012 15:31:20 +0200\r
+Subject: [PATCH] notmuch-show: add notmuch-show-mark-read-tags option\r
+\r
+The `notmuch-show-mark-read-tags' lists tags that are to be applied when\r
+message is read.  By default, the only value is "-unread" which will remove\r
+the unread tag.  Among other uses, this variable can be used to stop\r
+notmuch-show from modifying tags when message is shown (by setting the\r
+variable to an empty list).\r
+---\r
+ emacs/notmuch-show.el |   12 ++++++++++--\r
+ 1 files changed, 10 insertions(+), 2 deletions(-)\r
+\r
+diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
+index dcfc190..92a4beb 100644\r
+--- a/emacs/notmuch-show.el\r
++++ b/emacs/notmuch-show.el\r
+@@ -183,6 +183,13 @@ provided with an MLA argument nor `completing-read' in=\r
+put."\r
+            notmuch-show-stash-mlarchive-link-alist))\r
+   :group 'notmuch-show)\r
+=20\r
++(defcustom notmuch-show-mark-read-tags '("-unread")\r
++  "List of tags to apply when message is read, ie. shown in notmuch-show\r
++buffer."\r
++  :type '(repeat string)\r
++  :group 'notmuch-show)\r
++\r
++\r
+ (defmacro with-current-notmuch-show-message (&rest body)\r
+   "Evaluate body with current buffer set to the text of current message"\r
+   `(save-excursion\r
+@@ -1383,8 +1390,9 @@ current thread."\r
+   (notmuch-show-get-prop :headers-visible))\r
+=20\r
+ (defun notmuch-show-mark-read ()\r
+-  "Mark the current message as read."\r
+-  (notmuch-show-tag-message "-unread"))\r
++  "Apply `notmuch-show-mark-read-tags' to the message."\r
++  (when notmuch-show-mark-read-tags\r
++    (apply notmuch-show-tag-message notmuch-show-mark-read-tags)))\r
+=20\r
+ ;; Functions for getting attributes of several messages in the current\r
+ ;; thread.\r
+\r
+--=20\r
+Best regards,                                         _     _\r
+.o. | Liege of Serenely Enlightened Majesty of      o' \,=3D./ `o\r
+..o | Computer Science,  Micha=C5=82 =E2=80=9Cmina86=E2=80=9D Nazarewicz   =\r
+ (o o)\r
+ooo +----<email/xmpp: mpn@google.com>--------------ooO--(_)--Ooo--\r
+--=-=-=\r
+Content-Type: multipart/signed; boundary="==-=-=";\r
+       micalg=pgp-sha1; protocol="application/pgp-signature"\r
+\r
+--==-=-=\r
+Content-Type: text/plain\r
+\r
+\r
+--==-=-=\r
+Content-Type: application/pgp-signature\r
+\r
+-----BEGIN PGP SIGNATURE-----\r
+Version: GnuPG v1.4.10 (GNU/Linux)\r
+\r
+iQIcBAEBAgAGBQJQITUjAAoJECBgQBJQdR/0sW8P/jSm5/kLi+NroL9AMFuZ46td\r
+dF7PkkzxfjF40Zh/pYR4ismd7VXtj37o89AAp3KNOz5CKu6KtSu692E2BDEV3fWU\r
+eVsXj4qk3yEEs+E82WihuECu5LgBNFcQWAoc+2Fj0ct8isI9HuLF9Onj8e0jLgaY\r
+oOSoUnzCyB5Ga+O5QaM1JgYECV9nIfAibqf+6rhp8+6oZAHYTA5cJdXzDcGhB7V9\r
+d4Fw3/OYQqevMk1HIk27wt5zh322VMTmOaZrcNM8CwwaBttPGgmalcMf4cPTMo/4\r
+v7eCX+gaGMCbj691wKwmmz0UfVgQLfJYrugbgAJZkx0jRvSexBa1+JX8kVJqpAbG\r
+d98Kph8GTHJ7BXw62RLHFTPo8KKP7VzT0WNJ4bYA0QAEU6akLYORtkOUrYtYS4/F\r
+1LK9tICnEvASQlPEcZXx7mh5EaeTuzcKT+ML/Rn0rPVoC8TGybSzrU0B1onNfkBF\r
+79yMql/+Q1DQvw7YY7jYzAQL39u8FKVSVLVt5tHkk64D5+14TneaKZ2J+Fz1tHF/\r
+oZjzvFyWz1Emdh2EiN1UkhyAs57nVIGnQCKoQxoCaB/ZD+XIOYfVuMaP5jnw5O+v\r
+AuP0w3/R2KKvS3eaqFM2dbgviXf1kIjECqhpy73OBLYzhY0kvklYYa0elDcAB3kG\r
+sPAUSa7zu5o67xgyZLMj\r
+=db9A\r
+-----END PGP SIGNATURE-----\r
+--==-=-=--\r
+\r
+--=-=-=--\r