1 Return-Path: <racin@free.fr>
\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 99D29429E21
\r
6 for <notmuch@notmuchmail.org>; Mon, 7 Feb 2011 13:06:35 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=0.011 tagged_above=-999 required=5
\r
12 tests=[FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001,
\r
13 T_MIME_NO_TEXT=0.01] autolearn=disabled
\r
14 Received: from olra.theworths.org ([127.0.0.1])
\r
15 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
16 with ESMTP id w4GR+FX-2mAE for <notmuch@notmuchmail.org>;
\r
17 Mon, 7 Feb 2011 13:06:35 -0800 (PST)
\r
18 Received: from smtp3-g21.free.fr (smtp3-g21.free.fr [212.27.42.3])
\r
19 by olra.theworths.org (Postfix) with ESMTP id 0B1B8429E20
\r
20 for <notmuch@notmuchmail.org>; Mon, 7 Feb 2011 13:06:33 -0800 (PST)
\r
21 Received: from racin (unknown [82.239.207.166])
\r
22 by smtp3-g21.free.fr (Postfix) with ESMTP id F0721A622B
\r
23 for <notmuch@notmuchmail.org>; Mon, 7 Feb 2011 22:06:29 +0100 (CET)
\r
24 From: Matthieu Lemerre <racin@free.fr>
\r
25 To: notmuch <notmuch@notmuchmail.org>
\r
26 Subject: Org-mode support
\r
27 User-Agent: Notmuch/0.5 (http://notmuchmail.org) Emacs/23.2.1
\r
29 Date: Mon, 07 Feb 2011 22:22:17 +0100
\r
30 Message-ID: <87aai7k0ae.fsf@free.fr>
\r
32 Content-Type: multipart/mixed; boundary="=-=-="
\r
33 X-BeenThere: notmuch@notmuchmail.org
\r
34 X-Mailman-Version: 2.1.13
\r
36 List-Id: "Use and development of the notmuch mail system."
\r
37 <notmuch.notmuchmail.org>
\r
38 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
39 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
40 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
41 List-Post: <mailto:notmuch@notmuchmail.org>
\r
42 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
43 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
44 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
45 X-List-Received-Date: Mon, 07 Feb 2011 21:06:35 -0000
\r
52 I have written the org-mode support for notmuch a while ago. It allows
\r
53 to open links to notmuch from org-mode and create org-mode link from
\r
56 The current maintainer of the package is looking for feedback for
\r
57 inclusion of the package in the org-mode trunk, so if anyone is using
\r
58 org-mode, I think it would be a good idea to say so on the orgmode
\r
61 I have attached the corresponding file.
\r
67 Content-Type: application/emacs-lisp
\r
68 Content-Disposition: attachment; filename=org-notmuch.el
\r
69 Content-Transfer-Encoding: quoted-printable
\r
71 ;;; org-notmuch.el --- Support for links to notmuch messages from within Or=
\r
74 ;; Copyright (C) 2010 Matthieu Lemerre
\r
76 ;; Author: Matthieu Lemerre <racin@free.fr>
\r
77 ;; Keywords: outlines, hypermedia, calendar, wp
\r
78 ;; Homepage: http://orgmode.org
\r
80 ;; This file is free software; you can redistribute it and/or modify
\r
81 ;; it under the terms of the GNU General Public License as published by
\r
82 ;; the Free Software Foundation; either version 2, or (at your option)
\r
83 ;; any later version.
\r
85 ;; This file is distributed in the hope that it will be useful,
\r
86 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
87 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
88 ;; GNU General Public License for more details.
\r
90 ;; You should have received a copy of the GNU General Public License
\r
91 ;; along with GNU Emacs; see the file COPYING. If not, write to
\r
92 ;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
\r
93 ;; Boston, MA 02110-1301, USA.
\r
97 ;; This file implements links to notmuch messages and "searchs". A
\r
98 ;; search is a query to be performed by notmuch; it is the equivalent
\r
99 ;; to folders in other mail clients. Similarly, mails are refered to
\r
100 ;; by a query, so both a link can refer to several mails.
\r
102 ;; Links have one the following form
\r
103 ;; notmuch:<search terms>
\r
104 ;; notmuch-search:<search terms>.=20
\r
106 ;; The first form open the queries in notmuch-show mode, whereas the
\r
107 ;; second link open it in notmuch-search mode. Note that queries are
\r
108 ;; performed at the time the link is opened, and the result may be
\r
109 ;; different from whet the link was stored.
\r
113 ;; Install the link type
\r
114 (org-add-link-type "notmuch" 'org-notmuch-open)
\r
115 (add-hook 'org-store-link-functions 'org-notmuch-store-link)
\r
117 (defun org-notmuch-store-link ()
\r
118 "Store a link to a notmuch search or message."
\r
119 (when (eq major-mode 'notmuch-show-mode)
\r
120 (let* ((message-id (notmuch-show-get-prop :id))
\r
121 (subject (notmuch-show-get-subject))
\r
122 (to (notmuch-show-get-to))
\r
123 (from (notmuch-show-get-from))
\r
125 (org-store-link-props :type "notmuch" :from from :to to
\r
126 :subject subject :message-id message-id)
\r
127 (setq desc (org-email-link-description))
\r
128 (setq link (org-make-link "notmuch:" "id:" message-id))
\r
129 (org-add-link-props :link link :description desc)
\r
132 (defun org-notmuch-open (path)
\r
133 "Follow a notmuch message link specified by PATH."
\r
134 (org-notmuch-follow-link path))
\r
136 (defun org-notmuch-follow-link (search)
\r
137 "Follow a notmuch link to SEARCH.=20
\r
139 Can link to more than one message, if so all matching messages are shown."
\r
141 (notmuch-show (org-link-unescape search)))
\r
147 (org-add-link-type "notmuch-search" 'org-notmuch-search-open)
\r
148 (add-hook 'org-store-link-functions 'org-notmuch-search-store-link)
\r
150 (defun org-notmuch-search-store-link ()
\r
151 "Store a link to a notmuch search or message."
\r
152 (when (eq major-mode 'notmuch-search-mode)
\r
153 (let ((link (org-make-link "notmuch-search:"=20
\r
154 (org-link-escape notmuch-search-query-string)))
\r
155 (desc (concat "Notmuch search: " notmuch-search-query-string)))
\r
156 (org-store-link-props :type "notmuch-search"=20
\r
161 (defun org-notmuch-search-open (path)
\r
162 "Follow a notmuch message link specified by PATH."
\r
164 (org-notmuch-search-follow-link path))
\r
166 (defun org-notmuch-search-follow-link (search)
\r
167 "Follow a notmuch link by displaying SEARCH in notmuch-search mode."
\r
169 (notmuch-search (org-link-unescape search)))
\r
171 (provide 'org-notmuch)
\r
173 ;;; org-notmuch.el ends here
\r