[Patch v3 3/4] emacs: move notmuch-search-line-faces to "tag:" style.

Mark Walters markwalters1009 at gmail.com
Sat May 5 06:39:46 PDT 2012


notmuch-search-line-faces currently has pairs of the form ("TAG"
. FACE). This changes it so that the pairs need to be of the form
("tag:tag" . FACE). This makes it consistent with the same change to
notmuch-show-line-faces introduced in the next patch
where we allow colouring based on flags (match
and excluded) as well as tags. However, it will break people's
existing colouring lines.

It also makes it easier for the user to make the colouring rule for
search and show the same.
---
 emacs/notmuch.el |   17 ++++++++++++-----
 1 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index d5f40e2..40f0cbe 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -591,16 +591,16 @@ This function advances the next thread when finished."
 		  (goto-char (point-min))
 		  (forward-line (1- notmuch-search-target-line))))))))
 
-(defcustom notmuch-search-line-faces '(("unread" :weight bold)
-				       ("flagged" :foreground "blue"))
+(defcustom notmuch-search-line-faces '(("tag:unread" :weight bold)
+				       ("tag:flagged" :foreground "blue"))
   "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):
 
- (setq notmuch-search-line-faces '((\"deleted\" . (:foreground \"red\"
+ (setq notmuch-search-line-faces '((\"tag:deleted\" . (:foreground \"red\"
 						  :background \"blue\"))
-                                   (\"unread\" . (:foreground \"green\"))))
+                                   (\"tag:unread\" . (:foreground \"green\"))))
 
 The attributes defined for matching tags are merged, with later
 attributes overriding earlier. A message having both \"deleted\"
@@ -612,7 +612,14 @@ foreground and blue background."
 
 (defun notmuch-search-color-line (start end line-tag-list)
   "Colorize lines in `notmuch-show' based on tags."
-  (notmuch-color-line start end line-tag-list notmuch-search-line-faces))
+  ;; This is a little ugly (we do not match on flags in search-mode)
+  ;; but is done to keep the syntax consistent in
+  ;; notmuch-search-line-faces and notmuch-show-line-faces.
+  (let (tags-and-flags)
+    (mapc (lambda (tag)
+	    (setq tags-and-flags (cons (concat "tag:" tag) tags-and-flags)))
+	  line-tag-list)
+  (notmuch-color-line start end tags-and-flags notmuch-search-line-faces)))
 
 (defun notmuch-search-author-propertize (authors)
   "Split `authors' into matching and non-matching authors and
-- 
1.7.9.1



More information about the notmuch mailing list