[PATCH 6/6] emacs: add support for reversing notmuch-show-mark-read tag changes
authorJani Nikula <jani@nikula.org>
Sun, 2 Sep 2012 19:58:05 +0000 (22:58 +0300)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:49:19 +0000 (09:49 -0800)
dc/0e699fe6a6eccefa1dda280f8fb0054fac5426 [new file with mode: 0644]

diff --git a/dc/0e699fe6a6eccefa1dda280f8fb0054fac5426 b/dc/0e699fe6a6eccefa1dda280f8fb0054fac5426
new file mode 100644 (file)
index 0000000..48a1886
--- /dev/null
@@ -0,0 +1,127 @@
+Return-Path: <jani@nikula.org>\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 29AB5431FC0\r
+       for <notmuch@notmuchmail.org>; Sun,  2 Sep 2012 12:58:29 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References"\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+       tests=[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 VbvnDhdw481f for <notmuch@notmuchmail.org>;\r
+       Sun,  2 Sep 2012 12:58:28 -0700 (PDT)\r
+Received: from mail-lb0-f181.google.com (mail-lb0-f181.google.com\r
+       [209.85.217.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 2FC6A431FB6\r
+       for <notmuch@notmuchmail.org>; Sun,  2 Sep 2012 12:58:28 -0700 (PDT)\r
+Received: by mail-lb0-f181.google.com with SMTP id gk1so2402453lbb.26\r
+       for <notmuch@notmuchmail.org>; Sun, 02 Sep 2012 12:58:27 -0700 (PDT)\r
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
+       d=google.com; s=20120113;\r
+       h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references\r
+       :in-reply-to:references:x-gm-message-state;\r
+       bh=NAotDv459hN0jsIRemhOkbS9fpnJEIKpiGQ01BiMWyI=;\r
+       b=Qrg489bL2xY5Cua7AWq9q2DK+ONu4nmyclwaCmYaMf9hzWicgsxWwNCmlbF908NrBK\r
+       /cVIV6+mwRjwVvh/pKXdeTHWoVDks2775fIPpLWMyRFS4dhqMh7+lKWr7Tm2Bnf008x/\r
+       8z3FDdvcvQDg5wt4+j79KxOQy4fVfLOVsthVodWl6f0ikvFDMNhPKPZ2v1/IV/Jp9gDB\r
+       VDYxYxPVF/tmQU/ONxpxTk4TUXavLrvICM+QRqcWbras9nHa3NWlstN3znnRpOCWiNn9\r
+       BdWKGyA9O539igqaWSNyrgIeKeRzFeEkjhlPWmHnj6qsJrZqaki+jcEqJlnb/x8X1/4q\r
+       bIfQ==\r
+Received: by 10.152.131.42 with SMTP id oj10mr12023899lab.49.1346615907840;\r
+       Sun, 02 Sep 2012 12:58:27 -0700 (PDT)\r
+Received: from localhost (dsl-hkibrasgw4-fe51df00-27.dhcp.inet.fi.\r
+       [80.223.81.27])\r
+       by mx.google.com with ESMTPS id r1sm2750731lbk.12.2012.09.02.12.58.26\r
+       (version=SSLv3 cipher=OTHER); Sun, 02 Sep 2012 12:58:27 -0700 (PDT)\r
+From: Jani Nikula <jani@nikula.org>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 6/6] emacs: add support for reversing notmuch-show-mark-read\r
+       tag changes\r
+Date: Sun,  2 Sep 2012 22:58:05 +0300\r
+Message-Id:\r
+ <51fb66f6f49ef30a4dac2168aa5f8c270b84c2bd.1346614915.git.jani@nikula.org>\r
+X-Mailer: git-send-email 1.7.9.5\r
+In-Reply-To: <cover.1346614915.git.jani@nikula.org>\r
+References: <cover.1346614915.git.jani@nikula.org>\r
+In-Reply-To: <cover.1346614915.git.jani@nikula.org>\r
+References: <cover.1346614915.git.jani@nikula.org>\r
+X-Gm-Message-State:\r
+ ALoCoQljXPaWT7D3UKYRhy+eS8B5s82Vkv03rWRSpIBQnIJBn2aX240S3EeJkfkvQiGQtKSnThTa\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: Sun, 02 Sep 2012 19:58:29 -0000\r
+\r
+Since marking a message as read can now be a user customized set of\r
+tag changes, make reversing this easier. Allow a prefix argument to\r
+notmuch-show-mark-read to reverse the marking as read, similar to the\r
+unarchiving in notmuch-show-archive-message.\r
+\r
+While at it, update the relevant documentation to match that of other\r
+automatic tagging (i.e. archive and reply).\r
+---\r
+ emacs/notmuch-show.el |   25 ++++++++++++++++++++-----\r
+ 1 file changed, 20 insertions(+), 5 deletions(-)\r
+\r
+diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
+index e701aec..1c1cf9c 100644\r
+--- a/emacs/notmuch-show.el\r
++++ b/emacs/notmuch-show.el\r
+@@ -184,8 +184,15 @@ provided with an MLA argument nor `completing-read' input."\r
+   :group 'notmuch-show)\r
\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
++  "List of tag changes to apply to a message when it is marked as read.\r
++\r
++Tags starting with \"+\" (or not starting with either \"+\" or\r
++\"-\") in the list will be added, and tags starting with \"-\"\r
++will be removed from the message being marked as read.\r
++\r
++For example, if you wanted to remove an \"unread\" tag and add a\r
++\"read\" tag (which would make little sense), you would set:\r
++    (\"-unread\" \"+read\")"\r
+   :type '(repeat string)\r
+   :group 'notmuch-show)\r
\r
+@@ -1390,10 +1397,18 @@ current thread."\r
+   "Are the headers of the current message visible?"\r
+   (notmuch-show-get-prop :headers-visible))\r
\r
+-(defun notmuch-show-mark-read ()\r
+-  "Apply `notmuch-show-mark-read-tags' to the message."\r
++(defun notmuch-show-mark-read (&optional unread)\r
++  "Mark the current message as read.\r
++\r
++Mark the current message as read by applying the tag changes in\r
++`notmuch-show-mark-read-tags' to it (remove the \"unread\" tag by\r
++default). If a prefix argument is given, the message will be\r
++marked as unread, i.e. the tag changes in\r
++`notmuch-show-mark-read-tags' will be reversed."\r
++  (interactive "P")\r
+   (when notmuch-show-mark-read-tags\r
+-    (apply 'notmuch-show-tag-message notmuch-show-mark-read-tags)))\r
++    (apply 'notmuch-show-tag-message\r
++         (notmuch-tag-change-list notmuch-show-mark-read-tags unread))))\r
\r
+ ;; Functions for getting attributes of several messages in the current\r
+ ;; thread.\r
+-- \r
+1.7.9.5\r
+\r