sup-like label listings (elisp)
David Edmondson
dme at dme.org
Mon Apr 12 01:26:03 PDT 2010
Oops. That one wasn't complete. Try:
commit 0c55967141e7685b0ba23b45a74c1e48a5964f6c
Author: David Edmondson <dme at dme.org>
Date: Mon Apr 12 09:24:44 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..b6a5e5f 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -888,16 +888,43 @@ 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)
+ ;; Must come after `notmuch-folder-mode', as that kills all
+ ;; local variables.
+ (set (make-local-variable 'notmuch-folders) folders)
(notmuch-folder-add notmuch-folders)
(goto-char (point-min))
(goto-line n))))
dme.
--
David Edmondson, http://dme.org
More information about the notmuch
mailing list