Re: [PATCH] notmuch-show: add notmuch-show-auto-mark-read option
authorAustin Clements <amdragon@MIT.EDU>
Mon, 6 Aug 2012 16:28:44 +0000 (12:28 +2000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:48:53 +0000 (09:48 -0800)
53/66a0c425dd4592563b1ac173289e7a042edbb3 [new file with mode: 0644]

diff --git a/53/66a0c425dd4592563b1ac173289e7a042edbb3 b/53/66a0c425dd4592563b1ac173289e7a042edbb3
new file mode 100644 (file)
index 0000000..cbd5a23
--- /dev/null
@@ -0,0 +1,126 @@
+Return-Path: <amdragon@mit.edu>\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 D0438431FAF\r
+       for <notmuch@notmuchmail.org>; Mon,  6 Aug 2012 09:28:47 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\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 jUD3FjhEroXj for <notmuch@notmuchmail.org>;\r
+       Mon,  6 Aug 2012 09:28:47 -0700 (PDT)\r
+Received: from dmz-mailsec-scanner-1.mit.edu (DMZ-MAILSEC-SCANNER-1.MIT.EDU\r
+       [18.9.25.12])\r
+       by olra.theworths.org (Postfix) with ESMTP id 2768B431FAE\r
+       for <notmuch@notmuchmail.org>; Mon,  6 Aug 2012 09:28:47 -0700 (PDT)\r
+X-AuditID: 1209190c-b7f806d000006b87-84-501ff0becde6\r
+Received: from mailhub-auth-2.mit.edu ( [18.7.62.36])\r
+       by dmz-mailsec-scanner-1.mit.edu (Symantec Messaging Gateway) with SMTP\r
+       id 8F.69.27527.EB0FF105; Mon,  6 Aug 2012 12:28:46 -0400 (EDT)\r
+Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])\r
+       by mailhub-auth-2.mit.edu (8.13.8/8.9.2) with ESMTP id q76GSj3B020344; \r
+       Mon, 6 Aug 2012 12:28:46 -0400\r
+Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91])\r
+       (authenticated bits=0)\r
+       (User authenticated as amdragon@ATHENA.MIT.EDU)\r
+       by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q76GSiC5015768\r
+       (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
+       Mon, 6 Aug 2012 12:28:45 -0400 (EDT)\r
+Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.77)\r
+       (envelope-from <amdragon@mit.edu>)\r
+       id 1SyQAe-00031q-1f; Mon, 06 Aug 2012 12:28:44 -0400\r
+Date: Mon, 6 Aug 2012 12:28:44 -0400\r
+From: Austin Clements <amdragon@MIT.EDU>\r
+To: Michal Nazarewicz <mpn@google.com>\r
+Subject: Re: [PATCH] notmuch-show: add notmuch-show-auto-mark-read option\r
+Message-ID: <20120806162843.GJ22601@mit.edu>\r
+References:\r
+ <7c2931eb4d34ff78e4c73d721bc00dc60d185e6a.1344260116.git.mina86@mina86.com>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+Content-Disposition: inline\r
+In-Reply-To:\r
+ <7c2931eb4d34ff78e4c73d721bc00dc60d185e6a.1344260116.git.mina86@mina86.com>\r
+User-Agent: Mutt/1.5.21 (2010-09-15)\r
+X-Brightmail-Tracker:\r
+ H4sIAAAAAAAAA+NgFmpileLIzCtJLcpLzFFi42IRYrdT0d33QT7AoPOBusWr733sFtdvzmR2\r
+       YPJYsKnU49mqW8wBTFFcNimpOZllqUX6dglcGc3HVrIU7OGvmPPiAmsD4zGeLkZODgkBE4nP\r
+       39rYIWwxiQv31rN1MXJxCAnsY5TYM/EvI4SznlHi+935rBDOCSaJX9OPMUE4Sxgldj/oZALp\r
+       ZxFQkVhybh0ziM0moCGxbf9yRhBbREBN4uKfx2A1zALSEt9+N4PZwgKeEv/m/AOaysHBK6Aj\r
+       cWG9OkhYSCBc4n/nIjYQm1dAUOLkzCcsEK1aEjf+vWQCKQcZs/wfB0iYUyBCYtu8v2AfiAJd\r
+       MOXkNrYJjEKzkHTPQtI9C6F7ASPzKkbZlNwq3dzEzJzi1GTd4uTEvLzUIl1DvdzMEr3UlNJN\r
+       jKCg5pTk2cH45qDSIUYBDkYlHt5bBvIBQqyJZcWVuYcYJTmYlER5Y98BhfiS8lMqMxKLM+KL\r
+       SnNSiw8xSnAwK4nw1iwEyvGmJFZWpRblw6SkOViUxHkvp9z0FxJITyxJzU5NLUgtgsnKcHAo\r
+       SfA+eQ/UKFiUmp5akZaZU4KQZuLgBBnOAzT8CEgNb3FBYm5xZjpE/hSjopQ4rzAwbQgJgCQy\r
+       SvPgemFJ5xWjONArwryLQdp5gAkLrvsV0GAmoMHe8nIgg0sSEVJSDYzSOWcLnm/ws4v/O5Hb\r
+       7XtgzUp1oerfc5yz/hWe8c7dZSO6vivqzduUn4sWSDEHHivcunfvvanXmcuunVBOO3Tqw+39\r
+       RRfOHonndbbguC7zSMtz/9Xdh7odrPedvffw6oH9GnNl7hW0f++yd1kU/cBq3nqf1i9Tm/4J\r
+       tesKuolIJ07oFTqjF1GjxFKckWioxVxUnAgAvJG5shUDAAA=\r
+Cc: notmuch@notmuchmail.org\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 16:28:47 -0000\r
+\r
+LGTM, though I wonder: Is this actually what you want, or would you be\r
+happy with automatic read marking if it followed a different pattern\r
+(perhaps a more predictable pattern)?\r
+\r
+Quoth Michal Nazarewicz on Aug 06 at  4:20 pm:\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