1 Return-Path: <david@tethera.net>
\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 17B4F431FB6
\r
6 for <notmuch@notmuchmail.org>; Fri, 18 Jul 2014 12:41:00 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]
\r
13 Received: from olra.theworths.org ([127.0.0.1])
\r
14 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id oEPvXTcHBXEw for <notmuch@notmuchmail.org>;
\r
16 Fri, 18 Jul 2014 12:40:52 -0700 (PDT)
\r
17 Received: from yantan.tethera.net (yantan.tethera.net [199.188.72.155])
\r
18 (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits))
\r
19 (No client certificate requested)
\r
20 by olra.theworths.org (Postfix) with ESMTPS id C7FD7431FAE
\r
21 for <notmuch@notmuchmail.org>; Fri, 18 Jul 2014 12:40:52 -0700 (PDT)
\r
22 Received: from remotemail by yantan.tethera.net with local (Exim 4.80)
\r
23 (envelope-from <david@tethera.net>)
\r
24 id 1X8E1Q-0001lg-8G; Fri, 18 Jul 2014 16:40:48 -0300
\r
25 Received: (nullmailer pid 32294 invoked by uid 1000); Fri, 18 Jul 2014
\r
27 From: David Bremner <david@tethera.net>
\r
28 To: Alan Schmitt <alan.schmitt@polytechnique.org>, notmuch
\r
29 <notmuch@notmuchmail.org>
\r
30 Subject: Re: using notmuch programmatically from emacs
\r
31 In-Reply-To: <m2r41iyfs4.fsf@polytechnique.org>
\r
32 References: <m2r41iyfs4.fsf@polytechnique.org>
\r
33 User-Agent: Notmuch/0.18.1+6~g1ba7098 (http://notmuchmail.org) Emacs/24.3.1
\r
34 (x86_64-pc-linux-gnu)
\r
35 Date: Fri, 18 Jul 2014 16:40:44 -0300
\r
36 Message-ID: <871ttisber.fsf@tethera.net>
\r
38 Content-Type: text/plain
\r
39 X-BeenThere: notmuch@notmuchmail.org
\r
40 X-Mailman-Version: 2.1.13
\r
42 List-Id: "Use and development of the notmuch mail system."
\r
43 <notmuch.notmuchmail.org>
\r
44 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
45 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
46 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
47 List-Post: <mailto:notmuch@notmuchmail.org>
\r
48 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
49 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
50 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
51 X-List-Received-Date: Fri, 18 Jul 2014 19:41:00 -0000
\r
53 Alan Schmitt <alan.schmitt@polytechnique.org> writes:
\r
57 > I sometimes have to find a message knowing only its message id. I know
\r
58 > how to use a notmuch search in emacs to find the message, then use
\r
59 > another function to display it in gnus, but I would like to do it
\r
60 > directly without going through the *notmuch-search* buffer.
\r
62 > Right now I'm doing the following:
\r
64 > #+begin_src emacs-lisp
\r
65 > (defun as/msgid-to-gnus (msgid)
\r
66 > "Search for the MSGID using notmuch, then open the message with
\r
68 > (let ((file (shell-command-to-string (concat "notmuch search --output=files 'id:" msgid "'"))))
\r
70 The structured output formats (sexp, json) include file names, so you
\r
71 should be able to use something like the following
\r
73 (defun notmuch-query-get-message-filenames (&rest search-terms)
\r
74 "Return a list of message-ids of messages that match SEARCH-TERMS"
\r
75 (notmuch-query-map-threads
\r
76 (lambda (msg) (plist-get msg :filename))
\r
77 (notmuch-query-get-threads search-terms)))
\r
79 This is based on the example at the bottom of notmuch-query.el
\r