[PATCH 2/2] emacs: tree: use tag-format-tags

Mark Walters markwalters1009 at gmail.com
Thu Dec 19 11:12:24 PST 2013


Previously tree did not use tag-format-tags: since tree wants to
distinguish matching messages from non-matching messages it is not a
perfect fit.

However, in preparation for allowing tag-changes to be shown (i.e.,
added or deleted tags to be indicated) it is convenient to make all
places displaying tags call the same routines.

We modify notmuch-tag-format-tags slightly so that it can take and
argument for the default characteristics of the face before the
special tag features are applied.

This also means that things like the star symbol for flagged messages
all work in tree.
---
 emacs/notmuch-tag.el  |   17 +++++++++--------
 emacs/notmuch-tree.el |    8 ++++----
 2 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/emacs/notmuch-tag.el b/emacs/notmuch-tag.el
index b60f46c..908e7ad 100644
--- a/emacs/notmuch-tag.el
+++ b/emacs/notmuch-tag.el
@@ -148,15 +148,16 @@ This can be used with `notmuch-tag-format-image-data'."
 	(dolist (format (cdr formats) tag)
 	  (setq tag (eval format))))))))
 
-(defun notmuch-tag-format-tags (tags)
+(defun notmuch-tag-format-tags (tags &optional face)
   "Return a string representing formatted TAGS."
-  (notmuch-combine-face-text-property-string
-   (mapconcat #'identity
-	      ;; nil indicated that the tag was deliberately hidden
-	      (delq nil (mapcar #'notmuch-tag-format-tag tags))
-	      " ")
-   'notmuch-tag-face
-   t))
+  (let ((face (or face 'notmuch-tag-face)))
+    (notmuch-combine-face-text-property-string
+     (mapconcat #'identity
+		;; nil indicated that the tag was deliberately hidden
+		(delq nil (mapcar #'notmuch-tag-format-tag tags))
+		" ")
+     face
+     t)))
 
 (defcustom notmuch-before-tag-hook nil
   "Hooks that are run before tags of a message are modified.
diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el
index 599f76e..ee20f1a 100644
--- a/emacs/notmuch-tree.el
+++ b/emacs/notmuch-tree.el
@@ -690,10 +690,10 @@ unchanged ADDRESS if parsing fails."
 	    (face (if match
 		      'notmuch-tree-match-tag-face
 		    'notmuch-tree-no-match-tag-face)))
-	(propertize (format format-string
-			    (mapconcat #'identity tags " "))
-		    'face face))))))
-
+	(notmuch-combine-face-text-property-string
+	 (format format-string (notmuch-tag-format-tags tags face))
+	 face
+	 t))))))
 
 (defun notmuch-tree-format-field-list (field-list msg)
   "Format fields of MSG according to FIELD-LIST and return string"
-- 
1.7.9.1



More information about the notmuch mailing list