unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Pieter Praet <pieter@praet.org>
To: Jameson Graef Rollins <jrollins@finestructure.net>
Cc: Notmuch Mail <notmuch@notmuchmail.org>
Subject: [PATCH 3/3] emacs: colorize buttonized 'id:' links depending on the target message's state
Date: Thu, 12 Jan 2012 18:23:45 +0100	[thread overview]
Message-ID: <1326389025-18877-3-git-send-email-pieter@praet.org> (raw)
In-Reply-To: <1326389025-18877-1-git-send-email-pieter@praet.org>

* emacs/notmuch-show.el (notmuch-show-buttonized-link-present),
* emacs/notmuch-show.el (notmuch-show-buttonized-link-present-and-unread),
* emacs/notmuch-show.el (notmuch-show-buttonized-link-missing):
  new faces for buttonized id: links.

* emacs/notmuch-show.el (notmuch-show-found-target-p): add optional arg
  VERIFY-UNREAD which causes results to be filtered by "tag:unread".

* emacs/notmuch-show.el (notmuch-show-buttonize-links): use different
  face property depending on the result of `notmuch-show-found-target-p',
  causing buttons to present, present-and-unread and missing messages to
  be displayed in a different color.
---
 emacs/notmuch-show.el |   32 +++++++++++++++++++++++++++++---
 1 files changed, 29 insertions(+), 3 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 8f12955..25330c4 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -797,6 +797,27 @@ current buffer, if possible."
 (defvar notmuch-show-buffer-name nil)
 (make-variable-buffer-local 'notmuch-show-buffer-name)
 
+(defface notmuch-show-buttonized-link-present
+  '((t (:inherit goto-address-mail-face :foreground "blue")))
+  "Face used for buttonized links to messages which are present
+in the mail store."
+  :group 'notmuch-show
+  :group 'notmuch-appearance)
+
+(defface notmuch-show-buttonized-link-present-and-unread
+  '((t (:inherit goto-address-mail-face :foreground "green")))
+  "Face used for buttonized links to messages which are present
+in the mail store, and are tagged `unread'."
+  :group 'notmuch-show
+  :group 'notmuch-appearance)
+
+(defface notmuch-show-buttonized-link-missing
+  '((t (:inherit goto-address-mail-face :foreground "red")))
+  "Face used for buttonized links to messages which are NOT
+present in in the mail store."
+  :group 'notmuch-show
+  :group 'notmuch-appearance)
+
 (defun notmuch-show-buttonize-links (start end)
   "Buttonize URLs and mail addresses between START and END.
 
@@ -816,7 +837,12 @@ a corresponding notmuch search."
 				   (notmuch-show-if-found ,message-id))
 			'follow-link t
 			'help-echo "Mouse-1, RET: search for this message"
-			'face goto-address-mail-face))))
+			'face (cond
+			       ((notmuch-show-found-target-p message-id t)
+				'notmuch-show-buttonized-link-present-and-unread)
+			       ((notmuch-show-found-target-p message-id)
+				'notmuch-show-buttonized-link-present)
+			       (t 'notmuch-show-buttonized-link-missing)))))))
 
 ;;;###autoload
 (defun notmuch-show (thread-id &optional parent-buffer query-context buffer-name crypto-switch)
@@ -909,8 +935,8 @@ thread id.  If a prefix is given, crypto processing is toggled."
     (notmuch-kill-this-buffer)
     (notmuch-show-worker thread-id parent-buffer query-context buffer-name process-crypto)))
 
-(defun notmuch-show-found-target-p (target)
-  (let ((args `("count" ,target)))
+(defun notmuch-show-found-target-p (target &optional verify-unread)
+  (let ((args `("count" ,target ,(if verify-unread "and tag:unread" ""))))
     (> (string-to-number (substring
       (with-output-to-string
         (apply 'call-process notmuch-command nil standard-output nil args))
-- 
1.7.8.1

  parent reply	other threads:[~2012-01-12 17:25 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-23  4:59 [PATCH v2] emacs: call notmuch-show instead of notmuch-search in buttonised id: links Jameson Graef Rollins
2011-12-23  7:48 ` David Edmondson
2011-12-23 10:10   ` Xavier Maillard
2011-12-23 10:25     ` David Edmondson
2011-12-24 21:51 ` David Bremner
2012-01-12 17:20 ` Pieter Praet
2012-01-12 17:23   ` [PATCH 1/3] emacs: s/buttonise/buttonize/g Pieter Praet
2012-01-12 17:23     ` [PATCH 2/3] emacs: `notmuch-show-buttonize-links' only `notmuch-show's a message if it exists Pieter Praet
2012-01-16 11:43       ` David Edmondson
2012-01-16 16:49         ` Pieter Praet
2012-01-16 16:51           ` [PATCH v2] " Pieter Praet
2012-01-16 17:06             ` David Edmondson
2012-01-12 17:23     ` Pieter Praet [this message]
2012-01-16 11:45       ` [PATCH 3/3] emacs: colorize buttonized 'id:' links depending on the target message's state David Edmondson
2012-01-16 16:53         ` Pieter Praet
2012-01-16 16:54         ` Pieter Praet
2012-01-16 16:57           ` [PATCH] v2 " Pieter Praet
2012-01-16 17:07             ` David Edmondson
2012-01-16 21:43             ` Aaron Ecay
2012-01-18 10:08               ` Pieter Praet
2012-01-18 12:48                 ` [PATCH 3/3 v3] " Pieter Praet
2012-01-20 19:15                 ` [PATCH] v2 " Mark Anderson
2012-01-22  8:40                   ` Pieter Praet
2012-01-22  8:54                     ` [PATCH v4 1/3] emacs: s/buttonise/buttonize/g Pieter Praet
2012-01-22  8:54                     ` [PATCH v4 2/3] emacs: `notmuch-show-buttonize-links' only `notmuch-show's a message if it exists Pieter Praet
2012-01-22 11:10                       ` Mark Walters
2012-01-25  0:41                         ` Pieter Praet
2014-05-07 15:22                       ` David Edmondson
2017-03-05 11:52                         ` David Bremner
2012-01-22  8:54                     ` [PATCH v4 3/3] emacs: colorize buttonized 'id:' links depending on the target message's state Pieter Praet
2012-01-16 11:38     ` [PATCH 1/3] emacs: s/buttonise/buttonize/g David Edmondson
2012-01-25 11:16     ` David Bremner
2012-01-26 13:00       ` Pieter Praet
2012-01-26 14:34         ` Tomi Ollila
2017-03-05 11:51   ` [PATCH v2] emacs: call notmuch-show instead of notmuch-search in buttonised id: links David Bremner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1326389025-18877-3-git-send-email-pieter@praet.org \
    --to=pieter@praet.org \
    --cc=jrollins@finestructure.net \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).