info-gnus-english
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: notmuch?


From: Tassilo Horn
Subject: Re: notmuch?
Date: Fri, 27 Nov 2009 11:50:50 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux)

asjo@koldfront.dk (Adam Sjøgren) writes:

Hi Adam,

>> While you are still indexing, I already use it, and it's
>> fantastic. :-)
>
> With Gnus? Could you share some of your experiences, setup etc.?

Sure.  I use notmuch as search engine only, and do replying and normal
reading in Gnus.  So the most important part is to be able to jump from
a *notmuch-show* buffer to exactly that message in Gnus.  Here's the
code that here:

--8<---------------cut here---------------start------------->8---
(require 'notmuch)

(defun th-notmuch-file-to-group (file)
  "Calculate the Gnus group name from the given file name.

Example:

  IN: 
/home/horn/Mail/Dovecot/Fastmail/.INBOX.mailinglists.notmuch/cur/1259184569.M4818P3384.localhost,W=6921:2,S
  OUT: nnimap+Fastmail:INBOX.mailinglists.notmuch

  IN: 
/home/horn/Mail/Dovecot/Fastmail/cur/1259176906.M17483P24679.localhost,W=2488:2,S
  OUT:nnimap+Fastmail:INBOX"
  (let ((group (file-name-directory (directory-file-name (file-name-directory 
file)))))
    (setq group (replace-regexp-in-string "/home/horn/Mail/Dovecot/" "" group))
    (setq group (replace-regexp-in-string "^\\([^/]+\\)/" "nnimap+\\1:" group 
t))
    (setq group (replace-regexp-in-string "/$" "" group))
    (if (string-match ":$" group)
        (concat group "INBOX")
      (replace-regexp-in-string ":\\." ":" group))))

(defun th-notmuch-goto-message-in-gnus ()
  "Open a summary buffer containing the current notmuch
article."
  (interactive)
  (let ((group (th-notmuch-file-to-group (notmuch-show-get-filename)))
        (message-id (replace-regexp-in-string
                     "^id:" "" (notmuch-show-get-message-id))))
    (if (and group message-id)
        (org-gnus-follow-link group message-id)
      (message "Couldn't get relevant infos for switching to Gnus."))))

(define-key notmuch-show-mode-map (kbd "C-c C-c") 
'th-notmuch-goto-message-in-gnus)
--8<---------------cut here---------------end--------------->8---

The code assumes that one has his mails in a Maildir.  (I use a local
Dovecot IMAP client, which uses Maildir as default-backend.)

Additionally, it assumes that the Gnus server names (Fastmail and Uni)
equal the top-level maildir directories.

So most users will need to write an own version of
th-notmuch-file-to-group, but th-notmuch-goto-message-in-gnus should be
general.

The quintessence is that it uses org-gnus-follow-link, which comes with
org-mode and is also included in emacs 23.1 and newer.

Bye,
Tassilo





reply via email to

[Prev in Thread] Current Thread [Next in Thread]