Résumé : Link to Planner Mode page which contains NotMuch/Planner integration code.
> == NotMuch and Planner Mode ==
> I have posted code for integration of Notmuch with Planner Mode on the PlannerMode page.
NotMuch is an email indexing and search tool based on Xapian. Like Gmail, Notmuch relies on tagging and fast searching to organize mail. By default, incoming mail is given the tags “UNREAD” and “INBOX.” When the mail is read and archived the two tags, respectively, are removed.
Notmuch comes bundled with an emacs mail client that relies on message-mode for composing mail.
For more information about Notmuch, see the official wiki.
It is also possible to use NotMuch to index mail that is otherwise read in Gnus. See http://article.gmane.org/gmane.emacs.gnus.user/13308 for more details.
http://roland.entierement.nu/blog/2010/09/08/gnus-dovecot-offlineimap-search-a-howto.html suggests one way of setting up notmuch to work with Gnus. However, the functions for going from a notmuch result to the message in gnus needed some fiddling with on my end:
(defun notmuch-file-to-group (file) "Calculate the Gnus group name from the given file name." (let ((group (file-name-directory (directory-file-name (file-name-directory file))))) (setq group (replace-regexp-in-string ".*/.Maildir/" "nnimap+local:" group)) (setq group (replace-regexp-in-string "/$" "" group)) (if (string-match ":$" group) (concat group "INBOX") (replace-regexp-in-string ":\\." ":" group)) ;; Seems like we don't even need this part: (setq group (replace-regexp-in-string "nnimap\\+local:\\.?" "" group))))
(defun notmuch-goto-message-in-gnus () "Open a summary buffer containing the current notmuch article." (interactive) (unless (gnus-alive-p) (with-temp-buffer (gnus))) (let ((group (notmuch-file-to-group (notmuch-show-get-filename))) (message-id (replace-regexp-in-string "\"" "" (replace-regexp-in-string "^id:" "" (notmuch-show-get-message-id))))) (if (and group message-id) (progn (gnus-summary-read-group group 1) ; have to show at least one old message (gnus-summary-refer-article message-id)) ; simpler than org-gnus method? (message "Couldn't get relevant infos for switching to Gnus."))))
(define-key notmuch-show-mode-map (kbd "C-c C-c") 'notmuch-goto-message-in-gnus)
The standard way to expunge all the emails tagged with “deleted” is to run:
notmuch search --output=files tag:deleted | xargs -L 1 rm
However this fails if the path to any of the files contains spaces. In this case you need something like:
notmuch search --output=files tag:deleted | tr '\n' '\0' | xargs -0 -L 1 rm
This works on GNU/Linux but I can’t see why it should not work elsewhere. I don’t know if there is a simpler way to do it. The best thing to do seems to put the above line followed by:
in a shell script.
I have posted code for integration of Notmuch with Planner Mode on the PlannerMode page.