unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Brett Viren <brett.viren@gmail.com>
To: notmuch@notmuchmail.org
Subject: Re: Snippet to jump to message in Gnus from notmuch-show buffer
Date: Sat, 20 Nov 2010 20:12:41 -0500	[thread overview]
Message-ID: <AANLkTimrF2OXzJFNfhrJ-rA44FRDRw_7PKMGD3Kec2D4@mail.gmail.com> (raw)
In-Reply-To: <87zl6cl595.fsf@thinkpad.tsdh.de>

Hi Tassilo,

I adapted your code for my use and found it was failing due to some
stray double-quotes.  I'm using notmuch from git so maybe these quotes
were added in the year since you first posted your idea.

See below for the simple fix:

On Tue, Nov 24, 2009 at 3:02 AM, Tassilo Horn <tassilo@member.fsf.org> wrote:
> --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/uni/INBOX/dbox-Mails/u.4075
>  OUT: nnimap+Uni:INBOX"
>  (concat "nnimap+"
>          (replace-regexp-in-string
>           "^\\([^/]+\\)/" "\\1:"
>           (replace-regexp-in-string
>            "/dbox-Mails/.*" ""
>            (replace-regexp-in-string
>             "/home/horn/Mail/Dovecot/" "" file)))))
>
> (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))))

I needed to define the message-id like:

       (message-id (replace-regexp-in-string
		    "\"" ""
		    (replace-regexp-in-string
                    "^id:" "" (notmuch-show-get-message-id)))))


>    (message "G: %s, mid: %s" group 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---

Regards and thanks for this handy code!
-Brett.

      parent reply	other threads:[~2010-11-21  1:12 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-24  8:02 Snippet to jump to message in Gnus from notmuch-show buffer Tassilo Horn
2009-11-27 12:54 ` Carl Worth
2009-11-27 17:29   ` Kan-Ru Chen
2009-11-27 13:31 ` Carl Worth
2009-11-27 22:10   ` Tassilo Horn
2009-11-28 14:55     ` Adam Sjøgren
2009-12-02 20:51     ` Carl Worth
2009-12-02 21:12       ` Adam Sjøgren
2010-11-21  1:12 ` Brett Viren [this message]

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

  List information: https://notmuchmail.org/

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

  git send-email \
    --in-reply-to=AANLkTimrF2OXzJFNfhrJ-rA44FRDRw_7PKMGD3Kec2D4@mail.gmail.com \
    --to=brett.viren@gmail.com \
    --cc=notmuch@notmuchmail.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.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

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 read-only IMAP folder(s) and NNTP newsgroup(s).