Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id C29D04196F2 for ; Mon, 12 Apr 2010 01:26:10 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -1.9 X-Spam-Level: X-Spam-Status: No, score=-1.9 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001] autolearn=ham Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Fc40xPmcUvkm for ; Mon, 12 Apr 2010 01:26:10 -0700 (PDT) Received: from mail-bw0-f210.google.com (mail-bw0-f210.google.com [209.85.218.210]) by olra.theworths.org (Postfix) with ESMTP id CF714431FC1 for ; Mon, 12 Apr 2010 01:26:09 -0700 (PDT) Received: by bwz2 with SMTP id 2so3959561bwz.30 for ; Mon, 12 Apr 2010 01:26:08 -0700 (PDT) Received: by 10.204.4.211 with SMTP id 19mr4267027bks.166.1271060768355; Mon, 12 Apr 2010 01:26:08 -0700 (PDT) Received: from ut.hh.sledj.net (gmp-ea-fw-1b.sun.com [192.18.8.1]) by mx.google.com with ESMTPS id x16sm36105693bku.5.2010.04.12.01.26.06 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 12 Apr 2010 01:26:07 -0700 (PDT) Received: by ut.hh.sledj.net (Postfix, from userid 1000) id A1FDE5941E1; Mon, 12 Apr 2010 09:26:03 +0100 (BST) To: Taru Karttunen , notmuch@notmuchmail.org Subject: Re: sup-like label listings (elisp) In-Reply-To: <87ljctjdek.fsf@ut.hh.sledj.net> References: <87wrwd95tl.fsf@nar.taruti.net> <87ljctjdek.fsf@ut.hh.sledj.net> From: David Edmondson Date: Mon, 12 Apr 2010 09:26:03 +0100 Message-ID: <87k4sdjcv8.fsf@ut.hh.sledj.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Apr 2010 08:26:10 -0000 Oops. That one wasn't complete. Try: commit 0c55967141e7685b0ba23b45a74c1e48a5964f6c Author: David Edmondson 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