sup-like label listings (elisp)
authorTaru Karttunen <taruti@taruti.net>
Sun, 11 Apr 2010 18:56:06 +0000 (21:56 +0300)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:36:35 +0000 (09:36 -0800)
f8/d5e45c0e1d04889e8fd7bae43124ecf90573bd [new file with mode: 0644]

diff --git a/f8/d5e45c0e1d04889e8fd7bae43124ecf90573bd b/f8/d5e45c0e1d04889e8fd7bae43124ecf90573bd
new file mode 100644 (file)
index 0000000..e2b6848
--- /dev/null
@@ -0,0 +1,90 @@
+Return-Path: <taruti@taruti.net>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id EE9444196F2\r
+       for <notmuch@notmuchmail.org>; Sun, 11 Apr 2010 12:01:09 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -1.5\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-1.5 tagged_above=-999 required=5\r
+       tests=[BAYES_50=0.8, RCVD_IN_DNSWL_MED=-2.3] autolearn=ham\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id qDk6cvHmR7wx for <notmuch@notmuchmail.org>;\r
+       Sun, 11 Apr 2010 12:01:09 -0700 (PDT)\r
+X-Greylist: delayed 301 seconds by postgrey-1.32 at olra;\r
+       Sun, 11 Apr 2010 12:01:09 PDT\r
+Received: from mail.cs.helsinki.fi (courier.cs.helsinki.fi [128.214.9.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 3B3BB431FC1\r
+       for <notmuch@notmuchmail.org>; Sun, 11 Apr 2010 12:01:09 -0700 (PDT)\r
+Received: from nar.taruti.net (melkki.cs.helsinki.fi [128.214.9.98])\r
+       by mail.cs.helsinki.fi with esmtp; Sun, 11 Apr 2010 21:56:07 +0300\r
+       id 00093EA6.4BC21B47.000002DF\r
+From: Taru Karttunen <taruti@taruti.net>\r
+To: notmuch@notmuchmail.org\r
+Subject: sup-like label listings (elisp)\r
+Date: Sun, 11 Apr 2010 21:56:06 +0300\r
+Message-ID: <87wrwd95tl.fsf@nar.taruti.net>\r
+Mime-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+Content-Transfer-Encoding: 7bit\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sun, 11 Apr 2010 19:01:10 -0000\r
+\r
+\r
+Hello\r
+\r
+Attached is code to produce sup-like label listings.\r
+It adds two new shortcuts:\r
+'l' - produce a listing of all tags and their messages\r
+'L' - produce a listing of all tags and their unread (or starred) messages\r
+\r
+(defun taru-notmuch-t2unread (s)\r
+  (mapcar (lambda (s) (cons s (concat "tag:" s " AND (tag:unread OR tag:starred)"))) s))\r
+(defun taru-notmuch-t2all (s)\r
+  (mapcar (lambda (s) (cons s (concat "tag:" s))) s))\r
+\r
+(setq taru-notmuch-real-folders notmuch-folders)\r
+(setq notmuch-search-oldest-first nil)\r
+\r
+(defun taru-notmuch-all-tags () (process-lines "notmuch" "search-tags"))\r
+\r
+(setq notmuch-folders (taru-notmuch-t2all (taru-notmuch-all-tags)))\r
+\r
+(defun taru-notmuch-folders ()\r
+  (interactive)\r
+  (setq notmuch-folders taru-notmuch-real-folders)\r
+  (notmuch-folder))\r
+(defun taru-notmuch-list ()\r
+  (interactive)\r
+  (setq notmuch-folders (taru-notmuch-t2all (taru-notmuch-all-tags)))\r
+  (notmuch-folder))\r
+(defun taru-notmuch-listu ()\r
+  (interactive)\r
+  (setq notmuch-folders (taru-notmuch-t2unread (taru-notmuch-all-tags)))\r
+  (notmuch-folder))\r
+(defun taru-notmuch-addlist () \r
+  (local-set-key "F" 'taru-notmuch-folders) ; folders\r
+  (local-set-key "l" 'taru-notmuch-list)    ; all tags\r
+  (local-set-key "L" 'taru-notmuch-listu))  ; all tags - unread\r
+  \r
+(add-hook 'notmuch-search-hook 'taru-notmuch-addlist)\r
+\r
+\r
+I hope others will find this useful.\r
+\r
+\r
+- Taru Karttunen\r