sup-like label listings (elisp)

Taru Karttunen taruti at taruti.net
Sun Apr 11 11:56:06 PDT 2010


Hello

Attached is code to produce sup-like label listings.
It adds two new shortcuts:
'l' - produce a listing of all tags and their messages
'L' - produce a listing of all tags and their unread (or starred) messages

(defun taru-notmuch-t2unread (s)
  (mapcar (lambda (s) (cons s (concat "tag:" s " AND (tag:unread OR tag:starred)"))) s))
(defun taru-notmuch-t2all (s)
  (mapcar (lambda (s) (cons s (concat "tag:" s))) s))

(setq taru-notmuch-real-folders notmuch-folders)
(setq notmuch-search-oldest-first nil)

(defun taru-notmuch-all-tags () (process-lines "notmuch" "search-tags"))

(setq notmuch-folders (taru-notmuch-t2all (taru-notmuch-all-tags)))

(defun taru-notmuch-folders ()
  (interactive)
  (setq notmuch-folders taru-notmuch-real-folders)
  (notmuch-folder))
(defun taru-notmuch-list ()
  (interactive)
  (setq notmuch-folders (taru-notmuch-t2all (taru-notmuch-all-tags)))
  (notmuch-folder))
(defun taru-notmuch-listu ()
  (interactive)
  (setq notmuch-folders (taru-notmuch-t2unread (taru-notmuch-all-tags)))
  (notmuch-folder))
(defun taru-notmuch-addlist () 
  (local-set-key "F" 'taru-notmuch-folders) ; folders
  (local-set-key "l" 'taru-notmuch-list)    ; all tags
  (local-set-key "L" 'taru-notmuch-listu))  ; all tags - unread
  
(add-hook 'notmuch-search-hook 'taru-notmuch-addlist)


I hope others will find this useful.


- Taru Karttunen


More information about the notmuch mailing list