--- /dev/null
+Return-Path: <markwalters1009@gmail.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 12DB3431FD0\r
+ for <notmuch@notmuchmail.org>; Sun, 1 Dec 2013 02:08:13 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0.201\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0.201 tagged_above=-999 required=5\r
+ tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+ FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001,\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 RhPoRkrR3NQE for <notmuch@notmuchmail.org>;\r
+ Sun, 1 Dec 2013 02:08:05 -0800 (PST)\r
+Received: from mail-wi0-f171.google.com (mail-wi0-f171.google.com\r
+ [209.85.212.171]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id 509BB431FAF\r
+ for <notmuch@notmuchmail.org>; Sun, 1 Dec 2013 02:08:05 -0800 (PST)\r
+Received: by mail-wi0-f171.google.com with SMTP id ca18so3552693wib.16\r
+ for <notmuch@notmuchmail.org>; Sun, 01 Dec 2013 02:08:04 -0800 (PST)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
+ h=from:to:cc:subject:date:message-id:in-reply-to:references;\r
+ bh=Zdf/5A4SfScuQ7KaCvHjj0o5xJXio+s4Z7Ht9mWOeNo=;\r
+ b=UpzqM84dLsBXKgehGvy9XF1jeecQ/GeFNdrRrqi+ugdMuV9QVgtR7PA/MoTOqbVZM0\r
+ cOtkxk7cXH3KMcADDjnc+wSLImu4+N/rdZ7wZdSd+DPGC8Yhujap7xjletYJ4w0olbCC\r
+ 9wC4/CdHIEOLaQRIUSBwagmaaVJbtQ+ZAz38cqmZ/7+fiRJu5n4wMqcgOP9RdOfWLyBx\r
+ 9+pWU3Gxk9kLDd9cHVJFAOFKNOPJiJuCTxdsHMw1sFTA+Yjyt2sIepROeYy9feSvviIz\r
+ iTjnEGqY1AdUmJosokSoxPUhf2783tN6ujwoldiNL5QwwnX3WdLjoe2e2Y+ZAUEoEsj3\r
+ Sk8A==\r
+X-Received: by 10.180.107.193 with SMTP id he1mr13655896wib.50.1385892152410; \r
+ Sun, 01 Dec 2013 02:02:32 -0800 (PST)\r
+Received: from localhost (93-97-24-31.zone5.bethere.co.uk. [93.97.24.31])\r
+ by mx.google.com with ESMTPSA id e10sm88736579wiy.7.2013.12.01.02.02.31\r
+ for <multiple recipients>\r
+ (version=TLSv1.2 cipher=RC4-SHA bits=128/128);\r
+ Sun, 01 Dec 2013 02:02:31 -0800 (PST)\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH WIP v2 1/6] emacs: show: add a function to test for unread\r
+Date: Sun, 1 Dec 2013 10:02:22 +0000\r
+Message-Id: <1385892147-16994-2-git-send-email-markwalters1009@gmail.com>\r
+X-Mailer: git-send-email 1.7.9.1\r
+In-Reply-To: <1385892147-16994-1-git-send-email-markwalters1009@gmail.com>\r
+References: <1385892147-16994-1-git-send-email-markwalters1009@gmail.com>\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, 01 Dec 2013 10:08:13 -0000\r
+\r
+This adds a function which tests for unread. A message is deemed\r
+unread if applying `notmuch-show-mark-read-tags' would change the\r
+message's tags.\r
+---\r
+ emacs/notmuch-show.el | 11 +++++++++++\r
+ 1 files changed, 11 insertions(+), 0 deletions(-)\r
+\r
+diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
+index 784644c..a135e79 100644\r
+--- a/emacs/notmuch-show.el\r
++++ b/emacs/notmuch-show.el\r
+@@ -1510,6 +1510,17 @@ current thread."\r
+ "Are the headers of the current message visible?"\r
+ (notmuch-show-get-prop :headers-visible))\r
+ \r
++(defun notmuch-show-unread-p ()\r
++ "Return t if current message is unread.\r
++\r
++Returns t unless applying `notmuch-show-mark-read-tags' would be\r
++a no-op"\r
++ (when notmuch-show-mark-read-tags\r
++ (let* ((current-tags (notmuch-show-get-tags))\r
++ (tag-changes (notmuch-tag-change-list notmuch-show-mark-read-tags))\r
++ (new-tags (notmuch-update-tags current-tags tag-changes)))\r
++ (not (equal current-tags new-tags)))))\r
++\r
+ (put 'notmuch-show-mark-read 'notmuch-prefix-doc\r
+ "Mark the current message as unread.")\r
+ (defun notmuch-show-mark-read (&optional unread)\r
+-- \r
+1.7.9.1\r
+\r