From 3180b04a2ba9b020d6300210e623a05e4e1c1bd5 Mon Sep 17 00:00:00 2001 From: Alan Schmitt Date: Fri, 18 Jul 2014 15:09:47 +0200 Subject: [PATCH] using notmuch programmatically from emacs --- ac/14d9ede838241e5ec6cf298075e8af784b948a | 101 ++++++++++++++++++++++ 1 file changed, 101 insertions(+) create mode 100644 ac/14d9ede838241e5ec6cf298075e8af784b948a diff --git a/ac/14d9ede838241e5ec6cf298075e8af784b948a b/ac/14d9ede838241e5ec6cf298075e8af784b948a new file mode 100644 index 000000000..6373ee06e --- /dev/null +++ b/ac/14d9ede838241e5ec6cf298075e8af784b948a @@ -0,0 +1,101 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id 1E53B431FBD + for ; Fri, 18 Jul 2014 06:09:58 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -5 +X-Spam-Level: +X-Spam-Status: No, score=-5 tagged_above=-999 required=5 + tests=[RCVD_IN_DNSWL_HI=-5] autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id LXbkzbBYlpoz for ; + Fri, 18 Jul 2014 06:09:52 -0700 (PDT) +Received: from mail2-relais-roc.national.inria.fr + (mail2-relais-roc.national.inria.fr [192.134.164.83]) + (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 49CBC431FAE + for ; Fri, 18 Jul 2014 06:09:52 -0700 (PDT) +X-IronPort-AV: E=Sophos;i="5.01,685,1400018400"; d="scan'208";a="85919657" +Received: from cbg35-2-78-242-14-140.fbx.proxad.net (HELO top.local) + ([78.242.14.140]) + by mail2-relais-roc.national.inria.fr with ESMTP/TLS/AES128-SHA; + 18 Jul 2014 15:09:49 +0200 +From: Alan Schmitt +To: notmuch +Subject: using notmuch programmatically from emacs +Date: Fri, 18 Jul 2014 15:09:47 +0200 +Message-ID: +User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (darwin) +MIME-Version: 1.0 +Content-Type: multipart/signed; boundary="=-=-="; + micalg=pgp-sha512; protocol="application/pgp-signature" +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Fri, 18 Jul 2014 13:09:58 -0000 + +--=-=-= +Content-Type: text/plain +Content-Transfer-Encoding: quoted-printable + +Hello, + +I sometimes have to find a message knowing only its message id. I know +how to use a notmuch search in emacs to find the message, then use +another function to display it in gnus, but I would like to do it +directly without going through the *notmuch-search* buffer. + +Right now I'm doing the following: + +#+begin_src emacs-lisp + (defun as/msgid-to-gnus (msgid) + "Search for the MSGID using notmuch, then open the message with + gnus." + (let ((file (shell-command-to-string (concat "notmuch search --output= +=3Dfiles 'id:" msgid "'")))) + (gnus-summary-read-group (notmuch-file-to-group file)) + (gnus-summary-refer-article msgid))) +#+end_src + +(the `notmuch-file-to-group' function takes a file name and finds the +corresponding gnus group). + +Is there a way to do the same thing using notmuch.el functionality +(i.e., without having to do the `shell-command-to-string' myself)? + +Thanks, + +Alan + +=2D-=20 +OpenPGP Key ID : 040D0A3B4ED2E5C7 + +--=-=-= +Content-Type: application/pgp-signature + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG/MacGPG2 v2.0.22 (Darwin) + +iQEcBAEBCgAGBQJTyRyfAAoJEAQNCjtO0uXHFdcH/0B+Ks1NUUvD1uX7AmA1kBJI +5dfsbTs4EeG5hd53WAuSuWhYlljvZ5ktxuPuJ74AZOlX2rBE6/K7xpeT3gz4ppac +yE4dAbsnJ9dkt+xTYkGx2orTR70/rT72NglIrF19QG6v60qg6IE5IPTdVYYgA2Xf +0gKC3sDRGxLHFS3dNZuLkZ59uU7NCedlYrzTO11fDR93NqJ1aXHNeyyjDgPQ63Np +LgRxtEit93eCqOZNf4HDk00VvUaEGZRTVDYED1qSWPpxPwOW710dkLJnzrPncW6s +5QtDdnYXgB37XD0CQQ8h1NM6KIEUXPbH6y6Na7peSunwsuw15ulKFSeLN/z1SU4= +=Oiti +-----END PGP SIGNATURE----- +--=-=-=-- -- 2.26.2