using notmuch programmatically from emacs

Alan Schmitt alan.schmitt at polytechnique.org
Fri Jul 18 06:09:47 PDT 2014


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 494 bytes
Desc: not available
URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20140718/975fa9be/attachment.pgp>


More information about the notmuch mailing list