[PATCH 3/3] emacs: colorize buttonized 'id:' links depending on the target message's state

2012-01-16 Thread Pieter Praet
On Mon, 16 Jan 2012 11:45:13 +, David Edmondson  wrote:
> On Thu, 12 Jan 2012 18:23:45 +0100, Pieter Praet  wrote:
> > +   '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)))
> 
> I like it, but worry a bit more about the performance [...]

Rightly so :)

> [...] (we're up to two
> 'notmuch' invocations for a missing or read message).

I'll at least add an option to toggle it.

Patch follows.


Peace

-- 
Pieter


[PATCH 3/3] emacs: colorize buttonized 'id:' links depending on the target message's state

2012-01-16 Thread Pieter Praet
On Mon, 16 Jan 2012 11:45:13 +, David Edmondson  wrote:
> On Thu, 12 Jan 2012 18:23:45 +0100, Pieter Praet  wrote:
> > +   '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)))
> 
> I like it, but worry a bit more about the performance [...]

Rightly so :)

> [...] (we're up to two
> 'notmuch' invocations for a missing or read message).

I'll at least add an option to toggle it.

Patch follows.


Peace

-- 
Pieter


[PATCH 3/3] emacs: colorize buttonized 'id:' links depending on the target message's state

2012-01-16 Thread David Edmondson
On Thu, 12 Jan 2012 18:23:45 +0100, Pieter Praet  wrote:
> + '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)))

I like it, but worry a bit more about the performance (we're up to two
'notmuch' invocations for a missing or read message).
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: 



Re: [PATCH 3/3] emacs: colorize buttonized 'id:' links depending on the target message's state

2012-01-16 Thread Pieter Praet
On Mon, 16 Jan 2012 11:45:13 +, David Edmondson  wrote:
> On Thu, 12 Jan 2012 18:23:45 +0100, Pieter Praet  wrote:
> > +   '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)))
> 
> I like it, but worry a bit more about the performance [...]

Rightly so :)

> [...] (we're up to two
> 'notmuch' invocations for a missing or read message).

I'll at least add an option to toggle it.

Patch follows.


Peace

-- 
Pieter
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH 3/3] emacs: colorize buttonized 'id:' links depending on the target message's state

2012-01-16 Thread Pieter Praet
On Mon, 16 Jan 2012 11:45:13 +, David Edmondson  wrote:
> On Thu, 12 Jan 2012 18:23:45 +0100, Pieter Praet  wrote:
> > +   '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)))
> 
> I like it, but worry a bit more about the performance [...]

Rightly so :)

> [...] (we're up to two
> 'notmuch' invocations for a missing or read message).

I'll at least add an option to toggle it.

Patch follows.


Peace

-- 
Pieter
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH 3/3] emacs: colorize buttonized 'id:' links depending on the target message's state

2012-01-16 Thread David Edmondson
On Thu, 12 Jan 2012 18:23:45 +0100, Pieter Praet  wrote:
> + '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)))

I like it, but worry a bit more about the performance (we're up to two
'notmuch' invocations for a missing or read message).


pgpuHkWqQ3Zpw.pgp
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH 3/3] emacs: colorize buttonized 'id:' links depending on the target message's state

2012-01-12 Thread Pieter Praet
* 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



[PATCH 3/3] emacs: colorize buttonized 'id:' links depending on the target message's state

2012-01-12 Thread Pieter Praet
* 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

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch