Announcements and discussions for Gnus, the GNU Emacs Usenet newsreader
 help / color / mirror / Atom feed
From: Tassilo Horn <tassilo@member.fsf.org>
To: info-gnus-english@gnu.org
Subject: Re: notmuch?
Date: Fri, 27 Nov 2009 11:50:50 +0100	[thread overview]
Message-ID: <87r5rk8cmt.fsf@thinkpad.tsdh.de> (raw)
In-Reply-To: <87ocmpyscz.fsf@topper.koldfront.dk>

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	other threads:[~2009-11-27 10:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-25 20:55 notmuch? Adam Sjøgren
2009-11-26 19:32 ` notmuch? Tassilo Horn
     [not found] ` <mailman.11580.1259263995.2239.info-gnus-english@gnu.org>
2009-11-26 19:54   ` notmuch? Adam Sjøgren
2009-11-27 10:50     ` Tassilo Horn [this message]
2009-11-28 13:14 ` notmuch? David Engster

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87r5rk8cmt.fsf@thinkpad.tsdh.de \
    --to=tassilo@member.fsf.org \
    --cc=info-gnus-english@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).