[PATCH] don't show x-foo tags in search view

Subject: [PATCH] don't show x-foo tags in search view

Date: Mon, 29 Oct 2012 14:57:41 -0400

To: notmuch mailing list


From: James Vasile

My filters create tags like x-bogotrained-spam that are for internal
bookkeeping.  I don't mind seeing them in the 'show' view, but I didn't
want them cluttering my 'search' view.  This patch omits x-foo and X-foo
tags from the 'search' view.

 emacs/notmuch.el |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index f9454d8..90fafbf 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -793,7 +793,12 @@ non-authors is found, assume that all of the authors match."
     (notmuch-search-insert-authors format-string (plist-get result :authors)))
    ((string-equal field "tags")
-    (let ((tags-str (mapconcat 'identity (plist-get result :tags) " ")))
+    (let ((tags-str (mapconcat 'identity
+                              (delq nil
+                                    (mapcar (lambda (x) (if (equal (upcase (truncate-string-to-width  x 2)) "X-")
+                                                            nil
+                                                            (identity x))) (plist-get result :tags)))
+                              " ")))
       (insert (propertize (format format-string tags-str)
                          'face 'notmuch-tag-face))))))
part-000.sig (application/pgp-signature)