From the commit message:

    emacs: Make queries used in the all-tags section configurable
    
    This patch adds a customization variable that controls what queries
    are used to construct the all-tags section in notmuch-hello. It allows
    the user to specify a function to construct the query given a tag. It
    also allows hiding tags by returning nil.

Possible uses would be things like displaying the unread count for
tags instead of all messages with that tag and/or hiding uninteresting
tags like "signed" or "encrypted".

-- Daniel
From bc4e046537518255ad02254c88e7b5bedd347c2b Mon Sep 17 00:00:00 2001
From: Daniel Schoepe <daniel.scho...@googlemail.com>
Date: Fri, 20 May 2011 00:53:50 +0200
Subject: [PATCH] emacs: Make queries used in the all-tags section
 configurable

This patch adds a customization variable that controls what queries
are used to construct the all-tags section in notmuch-hello. It allows
the user to specify a function to construct the query given a tag. It
also allows hiding tags by returning nil.

Signed-off-by: Daniel Schoepe <daniel.scho...@googlemail.com>
---
 emacs/notmuch-hello.el |   25 ++++++++++++++++++++++---
 1 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index e58dd24..0b8c0b9 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -55,6 +55,17 @@
   :type 'boolean
   :group 'notmuch)
 
+(defcustom notmuch-hello-tag-list-make-query nil
+  "Function to generate queries for the all tags list.
+
+This variable controls which query results are shown for each tag
+in the \"all tags\" list. If this is nil, it uses the default of
+\"tag:TAG\", otherwise it should be a function of one argument,
+the tag, that should return the query to be used for that tag, or
+nil, in which case the tag will be hidden."
+  :type '(choice function (const nil :tag "tag:TAG"))
+  :group 'notmuch)
+
 (defface notmuch-hello-logo-background
   '((((class color)
       (background dark))
@@ -318,6 +329,16 @@ Complete list of currently available key bindings:
  ;;(setq buffer-read-only t)
 )
 
+(defun notmuch-hello-generate-tag-alist ()
+  "Return an alist from tags to queries to display in the all-tags section."
+  (filter 'cdr
+	  (mapcar '(lambda (tag)
+		     (cons tag
+			   (if notmuch-hello-tag-list-make-query
+			       (funcall notmuch-hello-tag-list-make-query tag)
+			     (concat "tag:" tag))))
+		  (process-lines notmuch-command "search-tags"))))
+
 ;;;###autoload
 (defun notmuch-hello (&optional no-display)
   "Run notmuch and display saved searches, known tags, etc."
@@ -396,9 +417,7 @@ Complete list of currently available key bindings:
 		      if (> (string-to-number (notmuch-saved-search-count (cdr elem))) 0)
 		      collect elem)))
 	     (saved-widest (notmuch-hello-longest-label saved-alist))
-	     (alltags-alist (if notmuch-show-all-tags-list
-				(mapcar '(lambda (tag) (cons tag (concat "tag:" tag)))
-					(process-lines notmuch-command "search-tags"))))
+	     (alltags-alist (if notmuch-show-all-tags-list (notmuch-hello-generate-tag-alist)))
 	     (alltags-widest (notmuch-hello-longest-label alltags-alist))
 	     (widest (max saved-widest alltags-widest)))
 
-- 
1.7.5.1

Attachment: pgpEeWasgJXnz.pgp
Description: PGP signature

_______________________________________________
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch

Reply via email to