From: Aaron Ecay <aaronecay@gmail.com>
To: notmuch@notmuchmail.org
Subject: [PATCH] Further improvements to tag-based coloring in search.
Date: Sat, 6 Feb 2010 20:21:43 -0500 [thread overview]
Message-ID: <1265505703-96736-1-git-send-email-aaronecay@gmail.com> (raw)
In-Reply-To: <87r5p01pqb.fsf@servo.finestructure.net>
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 <aaronecay@gmail.com>
---
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
next prev parent reply other threads:[~2010-02-07 1:21 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-04 12:07 [PATCH] notmuch.el: colorize lines in notmuch-search based on thread tags Jameson Rollins
2010-02-05 0:38 ` [PATCHv2] " Jameson Graef Rollins
2010-02-05 15:05 ` Jameson Graef Rollins
2010-02-07 1:21 ` Aaron Ecay [this message]
2010-04-07 18:20 ` [PATCH] Further improvements to tag-based coloring in search Carl Worth
2010-04-11 23:27 ` Aaron Ecay
2010-04-07 18:19 ` [PATCHv2] notmuch.el: colorize lines in notmuch-search based on thread tags Carl Worth
2010-02-07 15:44 ` [PATCH] " Aneesh Kumar K. V
2010-02-07 22:17 ` Aaron Ecay
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=1265505703-96736-1-git-send-email-aaronecay@gmail.com \
--to=aaronecay@gmail.com \
--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).