using notmuch programmatically from emacs

Subject: using notmuch programmatically from emacs

Date: Fri, 18 Jul 2014 15:09:47 +0200

To: notmuch

Cc:

From: Alan Schmitt


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=files '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

-- 
OpenPGP Key ID : 040D0A3B4ED2E5C7
part-000.sig (application/pgp-signature)

Thread: