Re: [PATCH v4 08/16] reorganize indexing of multipart/signed and multipart/encrypted
[notmuch-archives.git] / e8 / fc61d42559b52e7b23ccef358a881488b7d436
1 Return-Path: <tassilo@member.fsf.org>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id E9638431FBC\r
6         for <notmuch@notmuchmail.org>; Tue, 24 Nov 2009 00:02:49 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 Received: from olra.theworths.org ([127.0.0.1])\r
9         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
10         with ESMTP id PgA0ZmKZu1jU for <notmuch@notmuchmail.org>;\r
11         Tue, 24 Nov 2009 00:02:49 -0800 (PST)\r
12 Received: from deliver.uni-koblenz.de (deliver.uni-koblenz.de [141.26.64.15])\r
13         by olra.theworths.org (Postfix) with ESMTP id B13C6431FAE\r
14         for <notmuch@notmuchmail.org>; Tue, 24 Nov 2009 00:02:48 -0800 (PST)\r
15 Received: from localhost (localhost [127.0.0.1])\r
16         by deliver.uni-koblenz.de (Postfix) with ESMTP id 923F878A23F2\r
17         for <notmuch@notmuchmail.org>; Tue, 24 Nov 2009 09:02:47 +0100 (CET)\r
18 Received: from deliver.uni-koblenz.de ([127.0.0.1])\r
19         by localhost (deliver.uni-koblenz.de [127.0.0.1]) (amavisd-new,\r
20         port 10024) with ESMTP id 09054-10 for <notmuch@notmuchmail.org>;\r
21         Tue, 24 Nov 2009 09:02:47 +0100 (CET)\r
22 X-CHKRCPT: Envelopesender noch tassilo@member.fsf.org\r
23 Received: from thinkpad.tsdh.de (unknown [141.26.94.196])\r
24         by deliver.uni-koblenz.de (Postfix) with ESMTP id F264578A2375\r
25         for <notmuch@notmuchmail.org>; Tue, 24 Nov 2009 09:02:46 +0100 (CET)\r
26 From: Tassilo Horn <tassilo@member.fsf.org>\r
27 To: notmuch@notmuchmail.org\r
28 Mail-Copies-To: never\r
29 Mail-Followup-To: notmuch@notmuchmail.org\r
30 Date: Tue, 24 Nov 2009 09:02:46 +0100\r
31 Message-ID: <87zl6cl595.fsf@thinkpad.tsdh.de>\r
32 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux)\r
33 MIME-Version: 1.0\r
34 Content-Type: text/plain; charset=us-ascii\r
35 X-Virus-Scanned: amavisd-new at uni-koblenz.de\r
36 Subject: [notmuch] Snippet to jump to message in Gnus from notmuch-show\r
37         buffer\r
38 X-BeenThere: notmuch@notmuchmail.org\r
39 X-Mailman-Version: 2.1.12\r
40 Precedence: list\r
41 List-Id: "Use and development of the notmuch mail system."\r
42         <notmuch.notmuchmail.org>\r
43 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
44         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
45 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
46 List-Post: <mailto:notmuch@notmuchmail.org>\r
47 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
48 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
49         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
50 X-List-Received-Date: Tue, 24 Nov 2009 08:02:50 -0000\r
51 \r
52 Hi all,\r
53 \r
54 I'm a Gnus user and use notmuch mostly for searching.  When I want to\r
55 reply to a message, I need to get back to Gnus, so that my Gnus posting\r
56 styles (gcc into that group, right email address, correct signature,...)\r
57 are applied.\r
58 \r
59 Therefore, I created this small snippet.  Now C-c C-c inside some\r
60 message in the *notmuch-show* buffer opens this article in a Gnus\r
61 *Summary* buffer, where I can reply to it, forward it, ...\r
62 \r
63 Of course, the translation from file name to Gnus group name is\r
64 something that is different for any user.  The essence of this code is\r
65 the call to the org-gnus.el function `org-gnus-follow-link', which takes\r
66 the group name and the message-id.  It's included in Emacsen >= 23.\r
67 \r
68 --8<---------------cut here---------------start------------->8---\r
69 (require 'notmuch)\r
70 \r
71 (defun th-notmuch-file-to-group (file)\r
72   "Calculate the Gnus group name from the given file name.\r
73 \r
74 Example:\r
75 \r
76   IN: /home/horn/Mail/Dovecot/uni/INBOX/dbox-Mails/u.4075\r
77   OUT: nnimap+Uni:INBOX"\r
78   (concat "nnimap+"\r
79           (replace-regexp-in-string \r
80            "^\\([^/]+\\)/" "\\1:"\r
81            (replace-regexp-in-string \r
82             "/dbox-Mails/.*" ""\r
83             (replace-regexp-in-string\r
84              "/home/horn/Mail/Dovecot/" "" file)))))\r
85 \r
86 (defun th-notmuch-goto-message-in-gnus ()\r
87   "Open a summary buffer containing the current notmuch\r
88 article."\r
89   (interactive)\r
90   (let ((group (th-notmuch-file-to-group (notmuch-show-get-filename)))\r
91         (message-id (replace-regexp-in-string\r
92                      "^id:" "" (notmuch-show-get-message-id))))\r
93     (message "G: %s, mid: %s" group message-id)\r
94     (if (and group message-id)\r
95         (org-gnus-follow-link group message-id)\r
96       (message "Couldn't get relevant infos for switching to Gnus."))))\r
97 \r
98 (define-key notmuch-show-mode-map (kbd "C-c C-c") 'th-notmuch-goto-message-in-gnus)\r
99 --8<---------------cut here---------------end--------------->8---\r
100 \r
101 BTW, why does `notmuch-show-get-message-id' prefix the message-id with\r
102 "id:"?\r
103 \r
104 Bye,\r
105 Tassilo\r