From: David Edmondson <dme@dme.org>
To: Taru Karttunen <taruti@taruti.net>, notmuch@notmuchmail.org
Subject: Re: sup-like label listings (elisp)
Date: Mon, 12 Apr 2010 09:14:27 +0100 [thread overview]
Message-ID: <87ljctjdek.fsf@ut.hh.sledj.net> (raw)
In-Reply-To: <87wrwd95tl.fsf@nar.taruti.net>
How about this approach:
commit 0f591b5ac149179540327f1d300009b593c043ec
Author: David Edmondson <dme@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
next prev parent reply other threads:[~2010-04-12 8:14 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-11 18:56 sup-like label listings (elisp) Taru Karttunen
2010-04-12 8:14 ` David Edmondson [this message]
2010-04-12 8:26 ` David Edmondson
2010-04-12 8:38 ` Sebastian Spaeth
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87ljctjdek.fsf@ut.hh.sledj.net \
--to=dme@dme.org \
--cc=notmuch@notmuchmail.org \
--cc=taruti@taruti.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).