--- /dev/null
+Return-Path: <pieter@praet.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 41DC9431FAF\r
+ for <notmuch@notmuchmail.org>; Mon, 16 Jan 2012 08:59:28 -0800 (PST)\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 5EWhIKv30WKX for <notmuch@notmuchmail.org>;\r
+ Mon, 16 Jan 2012 08:59:27 -0800 (PST)\r
+Received: from mail-wi0-f181.google.com (mail-wi0-f181.google.com\r
+ [209.85.212.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id 8B04B431FAE\r
+ for <notmuch@notmuchmail.org>; Mon, 16 Jan 2012 08:59:27 -0800 (PST)\r
+Received: by wibhr12 with SMTP id hr12so2632349wib.26\r
+ for <notmuch@notmuchmail.org>; Mon, 16 Jan 2012 08:59:26 -0800 (PST)\r
+Received: by 10.180.88.229 with SMTP id bj5mr21773950wib.5.1326733166316;\r
+ Mon, 16 Jan 2012 08:59:26 -0800 (PST)\r
+Received: from localhost ([109.131.75.86])\r
+ by mx.google.com with ESMTPS id fi6sm35082784wib.2.2012.01.16.08.59.25\r
+ (version=TLSv1/SSLv3 cipher=OTHER);\r
+ Mon, 16 Jan 2012 08:59:25 -0800 (PST)\r
+From: Pieter Praet <pieter@praet.org>\r
+To: David Edmondson <dme@dme.org>,\r
+ Jameson Graef Rollins <jrollins@finestructure.net>\r
+Subject: [PATCH] v2 emacs: colorize buttonized 'id:' links depending on the\r
+ target message's state\r
+Date: Mon, 16 Jan 2012 17:57:33 +0100\r
+Message-Id: <1326733053-25185-1-git-send-email-pieter@praet.org>\r
+X-Mailer: git-send-email 1.7.8.1\r
+In-Reply-To: <87hazva8qe.fsf@praet.org>\r
+References: <87hazva8qe.fsf@praet.org>\r
+Cc: Notmuch Mail <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, 16 Jan 2012 16:59:28 -0000\r
+\r
+* emacs/notmuch-show.el (notmuch-show-buttonized-link-colors):\r
+ new defcustom, allows toggling colorization of buttonized links.\r
+\r
+* emacs/notmuch-show.el (notmuch-show-buttonized-link-present),\r
+* emacs/notmuch-show.el (notmuch-show-buttonized-link-present-and-unread),\r
+* emacs/notmuch-show.el (notmuch-show-buttonized-link-missing):\r
+ new faces for buttonized id: links.\r
+\r
+* emacs/notmuch-show.el (notmuch-show-found-target-p): add optional arg\r
+ VERIFY-UNREAD which causes results to be filtered by "tag:unread".\r
+\r
+* emacs/notmuch-show.el (notmuch-show-buttonize-links): use different\r
+ face property depending on the result of `notmuch-show-found-target-p',\r
+ causing buttons to available, available-and-unread and missing messages\r
+ to be displayed in a different color.\r
+\r
+---\r
+\r
+v2:\r
+\r
+- add `notmuch-show-buttonized-link-colors': new defcustom, allows\r
+ toggling colorization of buttonized links, to address concerns re\r
+ performance.\r
+- ... and some minor refactoring\r
+\r
+\r
+ emacs/notmuch-show.el | 45 ++++++++++++++++++++++++++++++++++++++++++---\r
+ 1 files changed, 42 insertions(+), 3 deletions(-)\r
+\r
+diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
+index 7a79d06..c6d7e29 100644\r
+--- a/emacs/notmuch-show.el\r
++++ b/emacs/notmuch-show.el\r
+@@ -794,6 +794,38 @@ current buffer, if possible."\r
+ (defvar notmuch-show-buffer-name nil)\r
+ (make-variable-buffer-local 'notmuch-show-buffer-name)\r
+ \r
++(defcustom notmuch-show-buttonized-link-colors t\r
++ "Colorize buttonized links depending on their target's state.\r
++\r
++Also see `notmuch-show-buttonized-link-available',\r
++ `notmuch-show-buttonized-link-available-and-unread',\r
++ `notmuch-show-buttonized-link-missing'.\r
++\r
++Might impact performance."\r
++ :type 'boolean\r
++ :group 'notmuch-show)\r
++\r
++(defface notmuch-show-buttonized-link-available\r
++ '((t (:inherit goto-address-mail-face :foreground "blue")))\r
++ "Face used for buttonized links to messages which are present\r
++in the mail store."\r
++ :group 'notmuch-show\r
++ :group 'notmuch-faces)\r
++\r
++(defface notmuch-show-buttonized-link-available-and-unread\r
++ '((t (:inherit goto-address-mail-face :foreground "green")))\r
++ "Face used for buttonized links to messages which are present\r
++in the mail store, and are tagged `unread'."\r
++ :group 'notmuch-show\r
++ :group 'notmuch-faces)\r
++\r
++(defface notmuch-show-buttonized-link-missing\r
++ '((t (:inherit goto-address-mail-face :foreground "red")))\r
++ "Face used for buttonized links to messages which are NOT\r
++present in in the mail store."\r
++ :group 'notmuch-show\r
++ :group 'notmuch-faces)\r
++\r
+ (defun notmuch-show-buttonize-links (start end)\r
+ "Buttonize URLs and mail addresses between START and END.\r
+ \r
+@@ -813,7 +845,14 @@ a corresponding notmuch search."\r
+ (notmuch-show-if-found ,message-id))\r
+ 'follow-link t\r
+ 'help-echo "Mouse-1, RET: search for this message"\r
+- 'face goto-address-mail-face)))))\r
++ 'face (if notmuch-show-buttonized-link-colors\r
++ (cond\r
++ ((notmuch-show-found-target-p message-id "and tag:unread")\r
++ 'notmuch-show-buttonized-link-available-and-unread)\r
++ ((notmuch-show-found-target-p message-id nil)\r
++ 'notmuch-show-buttonized-link-available)\r
++ (t 'notmuch-show-buttonized-link-missing))\r
++ 'goto-address-mail-face))))))\r
+ \r
+ ;;;###autoload\r
+ (defun notmuch-show (thread-id &optional parent-buffer query-context buffer-name crypto-switch)\r
+@@ -906,8 +945,8 @@ thread id. If a prefix is given, crypto processing is toggled."\r
+ (notmuch-kill-this-buffer)\r
+ (notmuch-show-worker thread-id parent-buffer query-context buffer-name process-crypto)))\r
+ \r
+-(defun notmuch-show-found-target-p (target)\r
+- (let ((args `("count" ,target)))\r
++(defun notmuch-show-found-target-p (target &optional subquery)\r
++ (let ((args `("count" ,target ,(or subquery ""))))\r
+ (> (string-to-number\r
+ (with-output-to-string\r
+ (apply 'call-process notmuch-command nil standard-output nil args)))\r
+-- \r
+1.7.8.1\r