[notmuch] [PATCH] Further improvements to tag-based coloring in search.

2010-04-07 Thread Carl Worth
On Sat,  6 Feb 2010 20:21:43 -0500, Aaron Ecay  wrote:
> Makes the following improvements:
> - fix up doc strings
> - suppress the creation of unnecessary let-bindings
> - create overlays lazily (to avoid creating many overlays for threads
>   that do not get colored)

Hi Aaron,

I saw this fixed-up version from you only after I'd pushed the previous
one. If you could resend a new change on top of what's now in master,
then that would be appreciated.

Thanks,

-Carl
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: 



Re: [notmuch] [PATCH] Further improvements to tag-based coloring in search.

2010-04-07 Thread Carl Worth
On Sat,  6 Feb 2010 20:21:43 -0500, Aaron Ecay aarone...@gmail.com wrote:
 Makes the following improvements:
 - fix up doc strings
 - suppress the creation of unnecessary let-bindings
 - create overlays lazily (to avoid creating many overlays for threads
   that do not get colored)

Hi Aaron,

I saw this fixed-up version from you only after I'd pushed the previous
one. If you could resend a new change on top of what's now in master,
then that would be appreciated.

Thanks,

-Carl


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


[notmuch] [PATCH] Further improvements to tag-based coloring in search.

2010-02-06 Thread Aaron Ecay
Makes the following improvements:
- fix up doc strings
- suppress the creation of unnecessary let-bindings
- create overlays lazily (to avoid creating many overlays for threads
  that do not get colored)

Signed-off-by: Aaron Ecay 
---
 notmuch.el |   29 ++---
 1 files changed, 14 insertions(+), 15 deletions(-)

diff --git a/notmuch.el b/notmuch.el
index 46159af..fff2192 100644
--- a/notmuch.el
+++ b/notmuch.el
@@ -1257,8 +1257,7 @@ This function advances the next thread when finished."
   '(("delete" . (:foreground "DarkGrey")))
   "Tag/face mapping for line highlighting in notmuch-search.

-Here is an example of how to color search results based on tags.
-(the following text would be placed in your ~/.emacs file):
+Here is an example of how to color search results based on tags:

 (setq notmuch-search-line-faces '((\"delete\" . (:foreground \"red\"))
  (\"unread\" . (:foreground \"green\"
@@ -1269,19 +1268,19 @@ matching will be applied."
   :group 'notmuch)

 (defun notmuch-search-color-line (start end line-tag-list)
-  "Colorize lines in notmuch-search based on tags"
-  (if notmuch-search-line-faces
-  (let ((overlay (make-overlay start end))
-   (tags-faces (copy-alist notmuch-search-line-faces)))
-   (while tags-faces
- (let* ((tag-face (car tags-faces))
-(tag (car tag-face))
-(face (cdr tag-face)))
-   (cond ((member tag line-tag-list)
-  (overlay-put overlay 'face face)
-  (setq tags-faces nil))
- (t
-  (setq tags-faces (cdr tags-faces)
+  "Colorize lines in notmuch-search based on tags.
+
+Uses the tag/face mappings found in `notmuch-search-line-faces'."
+  (when notmuch-search-line-faces
+(let ((tags-faces notmuch-search-line-faces))
+  (while tags-faces
+(let ((tag (caar tags-faces))
+  (face (cdar tags-faces)))
+  (cond ((member tag line-tag-list)
+ (overlay-put (make-overlay start end) 'face face)
+ (setq tags-faces nil))
+(t
+ (setq tags-faces (cdr tags-faces)

 (defun notmuch-search-process-filter (proc string)
   "Process and filter the output of \"notmuch search\""
-- 
1.6.6