sup-like label listings (elisp)

David Edmondson dme at dme.org
Mon Apr 12 01:14:27 PDT 2010


How about this approach:

commit 0f591b5ac149179540327f1d300009b593c043ec
Author: David Edmondson <dme at dme.org>
Date:   Mon Apr 12 09:13:15 2010 +0100

    emacs: More flexible folder mode construction
    
    Allow callers to `notmuch-folder' to optionally specify the alist of
    folders to be shown and a title for the buffer.
    
    Add `notmuch-folder-all-tags' and `notmuch-folder-all-tags-unread'
    based on the above.

	Modified emacs/notmuch.el
diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index 6d44249..7b867c6 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -888,17 +888,41 @@ Currently available key bindings:
     (if search
 	(notmuch-search (cdr search) notmuch-search-oldest-first))))
 
+(defun notmuch-folder-all-tags-unread ()
+  "Show the notmuch folder view for messages tagged `unread' for
+all tags."
+  (interactive)
+  (notmuch-folder-all-tags "tag:unread"))
+
+(defun notmuch-folder-all-tags (&optional search-restriction)
+  "Show the notmuch folder view for all tags. The optional
+parameter `search-restriction' allows the tag based search to be
+refined."
+  (interactive)
+  (notmuch-folder
+   (mapcar '(lambda (tag)
+	      (cons tag (concat "tag:" tag
+				(if search-restriction
+				    (concat " AND ( " search-restriction " )")
+				  ""))))
+	   (process-lines notmuch-command "search-tags"))
+   search-restriction))
+
 ;;;###autoload
-(defun notmuch-folder ()
+(defun notmuch-folder (&optional folders title)
   "Show the notmuch folder view and update the displayed counts."
   (interactive)
-  (let ((buffer (get-buffer-create "*notmuch-folders*")))
+  (let ((buffer (get-buffer-create
+		 (concat "*notmuch-folders"
+			 (if title (concat "-" title) "")
+			 "*")))
+	(folders (or folders notmuch-folders)))
     (switch-to-buffer buffer)
     (let ((inhibit-read-only t)
 	  (n (line-number-at-pos)))
       (erase-buffer)
       (notmuch-folder-mode)
-      (notmuch-folder-add notmuch-folders)
+      (notmuch-folder-add folders)
       (goto-char (point-min))
       (goto-line n))))
 


dme.
-- 
David Edmondson, http://dme.org


More information about the notmuch mailing list