[PATCH] notmuch-show: add notmuch-show-auto-mark-read option
authorMichal Nazarewicz <mpn@google.com>
Mon, 6 Aug 2012 14:20:11 +0000 (16:20 +0200)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:48:53 +0000 (09:48 -0800)
5b/6b8f60278b467f06aa147d3a91bb9ccfe8afa6 [new file with mode: 0644]

diff --git a/5b/6b8f60278b467f06aa147d3a91bb9ccfe8afa6 b/5b/6b8f60278b467f06aa147d3a91bb9ccfe8afa6
new file mode 100644 (file)
index 0000000..3d11788
--- /dev/null
@@ -0,0 +1,119 @@
+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 46982431FB6\r
+       for <notmuch@notmuchmail.org>; Mon,  6 Aug 2012 07:20:28 -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 NaL3OWC5aXbQ for <notmuch@notmuchmail.org>;\r
+       Mon,  6 Aug 2012 07:20:24 -0700 (PDT)\r
+Received: from mail-ee0-f53.google.com (mail-ee0-f53.google.com\r
+ [74.125.83.53])       (using TLSv1 with cipher RC4-SHA (128/128 bits))        (No client\r
+ certificate requested)        by olra.theworths.org (Postfix) with ESMTPS id\r
+ DAC04431FAE   for <notmuch@notmuchmail.org>; Mon,  6 Aug 2012 07:20:23 -0700\r
+ (PDT)\r
+Received: by eekc4 with SMTP id c4so1222538eek.26\r
+       for <notmuch@notmuchmail.org>; Mon, 06 Aug 2012 07:20:21 -0700 (PDT)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;\r
+ s=20120113;   h=from:to:subject:date:message-id:x-mailer;\r
+       bh=USYpGIiSNKLpp+KRusWbpAA/QAu+G/dsiBtrA2izd4w=;\r
+       b=H4HxC9cuiTwGOF7bSyiAabFu5IspUWbPgYbWmirOgDJg94WKnHZLXVGR5SdHeD50Y1\r
+       uNvmq4mL7IhR1fzIn3tIRT0s+EwFMcnwSlevxqdYHvhIzWlrYFE4uWUIWYUFWIh7NEYB\r
+       PlsSM5EmkqUgJEVC+oJiZp3pOqJP9RXrgpXoy28gWl7xBYZto8lrdOdzWfQwNStAiyx9\r
+       YNtQ0jSPk0aq9Zt1z02viuy4+9PItVp/kQuTeYHfPW7BitWXr2MqA9P/UBsvVRmEEjjF\r
+       8C8mKD+OigVh1gHIIV18vbMt7rI0dHMpR9BJQCfgnkih3/Rqi0QCs33h9onrSE4Zxjus    OzJw==\r
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
+       d=google.com; s=20120113;\r
+       h=from:to:subject:date:message-id:x-mailer:x-gm-message-state;\r
+       bh=USYpGIiSNKLpp+KRusWbpAA/QAu+G/dsiBtrA2izd4w=;\r
+       b=X74RwV7DUyDgFb7xkuyOHZil+TW2dO7HmqAuRU+eHilDxfT/QaZmYUVRHRi8NkY5bG\r
+       I725VIUaz7NaqisILO/lLijjIWEmBemRjfpKD2Ovgx/6DUsnVEB0SEVJ5F+x+PJJy2z2\r
+       FPj19+t8gJgByFIAcuZfqCVPUkRxGt/QKkRy3k+yZYcofmX+h3asH/GNEIo97CRYtrMF\r
+       j44/UWAci32Q2w1jsWGasDQo0IkfNdm980UNIteWQ5GMB4Vhvatsew52xLbHXtrl0fpZ\r
+       bAUPd3ZrTKqZGYlSQt7INmTjvC6FZdwK8HrBdgtdSbIwOgyi6AH8IzdFWYdghn8WR4Ot\r
+       H3SA==\r
+Received: by 10.14.181.137 with SMTP id l9mr13173133eem.28.1344262821318;\r
+       Mon, 06 Aug 2012 07:20:21 -0700 (PDT)\r
+Received: by 10.14.181.137 with SMTP id l9mr13173119eem.28.1344262821187;\r
+       Mon, 06 Aug 2012 07:20:21 -0700 (PDT)\r
+Received: from mpn-glaptop.corp.google.com\r
+       (dhcp-172-16-75-225.zrh.corp.google.com [172.16.75.225])\r
+       by mx.google.com with ESMTPS id j4sm48042780eeo.11.2012.08.06.07.20.19\r
+       (version=SSLv3 cipher=OTHER); Mon, 06 Aug 2012 07:20:20 -0700 (PDT)\r
+From: Michal Nazarewicz <mpn@google.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH] notmuch-show: add notmuch-show-auto-mark-read option\r
+Date: Mon,  6 Aug 2012 16:20:11 +0200\r
+Message-Id:\r
+ <7c2931eb4d34ff78e4c73d721bc00dc60d185e6a.1344260116.git.mina86@mina86.com>\r
+X-Mailer: git-send-email 1.7.7.3\r
+X-Gm-Message-State: ALoCoQljXK12dEABzPfFtj2/1Yt6X/H+TDMtckBkggNenJcr7EtRAQ2hlckvwF8yEJcTRxash4ppQE6XZi6cn6IrDCTTSSLwbLzFDnA2ZF3Dk9V4M3kjbfXeDYdkU41ypmqpWslTOG1cXnsFloyGvRTtGsyVGjHTyHdkJ7MyP49hxM9MTt5MK8LP9j1692SPXLxq8Tp5tVBhoRPip/+H8we0AJsMXIHVnw==\r
+X-Mailman-Approved-At: Mon, 06 Aug 2012 07:42:46 -0700\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: Mon, 06 Aug 2012 14:20:28 -0000\r
+\r
+From: Michal Nazarewicz <mina86@mina86.com>\r
+\r
+Setting `notmuch-show-auto-mark-read' to nil stops notmuch-show from marking\r
+the message as read (by removing the unread tag).  Inteded for people who\r
+like to mark messages read explicitly.\r
+---\r
+ emacs/notmuch-show.el |   16 +++++++++++++---\r
+ 1 files changed, 13 insertions(+), 3 deletions(-)\r
+\r
+diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
+index d318430..85a17b1 100644\r
+--- a/emacs/notmuch-show.el\r
++++ b/emacs/notmuch-show.el\r
+@@ -183,6 +183,14 @@ provided with an MLA argument nor `completing-read' input."\r
+            notmuch-show-stash-mlarchive-link-alist))\r
+   :group 'notmuch-show)\r
+ \r
++(defcustom notmuch-show-auto-mark-read t\r
++  "Whether to automatically mark message as read when it is shown.  If\r
++nil, message needs to be marked as read manually for instance by\r
++removing the unread tag."\r
++  :type 'boolean\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
+@@ -1374,9 +1382,11 @@ 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
+-  "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
+ ;; Functions for getting attributes of several messages in the current\r
+ ;; thread.\r
+-- \r
+1.7.7.3\r
+\r