Add a pseudo tag that matches all the messages that have no tags. Add new
customization option notmuch-tags-nomatch to enable and name the pseudo
tag.
---
 emacs/notmuch-hello.el |   18 ++++++++++++++++--
 1 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index b9c9b01..1770f60 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -53,6 +53,12 @@
                 string)
   :group 'notmuch)
 
+(defcustom notmuch-tags-nomatch nil
+  "Name of the pseudo tag to match messages that have no tags."
+  :type '(choice (const :tag "Off" nil)
+                string)
+  :group 'notmuch)
+
 (defvar notmuch-hello-indent 4
   "How much to indent non-headers.")
 
@@ -352,7 +358,7 @@ Complete list of currently available key bindings:
 
 (defun notmuch-hello-generate-tag-alist ()
   "Return an alist from tags to queries to display in the all-tags section."
-  (notmuch-remove-if-not
+  (let ((tag-alist (notmuch-remove-if-not
    #'cdr
    (mapcar (lambda (tag)
             (cons tag
@@ -367,7 +373,15 @@ Complete list of currently available key bindings:
           (notmuch-remove-if-not
            (lambda (tag)
              (not (member tag notmuch-hello-hide-tags)))
-           (process-lines notmuch-command "search-tags")))))
+           (process-lines notmuch-command "search-tags"))))))
+    (when notmuch-tags-nomatch
+      (let ((no-tag-search
+            (cons notmuch-tags-nomatch
+                  (mapconcat (lambda (arg) (concat "(not (" (cdr arg) "))")) 
tag-alist " and "))))
+       (if (> (string-to-number (notmuch-saved-search-count (cdr 
no-tag-search))) 0)
+           ;; Append the no-match search.
+           (add-to-list 'tag-alist no-tag-search t))))
+    tag-alist))
 
 (defun notmuch-hello-saved-alist ()
   (if notmuch-saved-searches
-- 
1.7.1

_______________________________________________
notmuch mailing list
[email protected]
http://notmuchmail.org/mailman/listinfo/notmuch

Reply via email to