From 8d69ec9c7ac4b4ee8a9a2df244ac6130a66979a9 Mon Sep 17 00:00:00 2001 From: jao Date: Sun, 4 Jul 2021 03:21:13 +0100 Subject: recovering explicit org-notmuch integration --- notmuch.org | 42 +++++++++++++++++++++++++++++++++++++----- 1 file changed, 37 insertions(+), 5 deletions(-) (limited to 'notmuch.org') diff --git a/notmuch.org b/notmuch.org index 651374f..768bec7 100644 --- a/notmuch.org +++ b/notmuch.org @@ -298,8 +298,40 @@ (with-eval-after-load "notmuch-hello" (define-key notmuch-hello-mode-map "f" #'jao-consult-notmuch-folder)) #+end_src -* org mode integration - #+begin_src emacs-lisp - (jao-load-path "ol-notmuch") - (use-package ol-notmuch :demand t) - #+end_src +* org mode + Stolen and adapted from [[https://gist.github.com/fedxa/fac592424473f1b70ea489cc64e08911][Fedor Bezrukov]]. + #+begin_src emacs-lisp + (with-eval-after-load "org" + (with-eval-after-load "notmuch" + (org-link-set-parameters "notmuch" + :follow 'org-notmuch-open + :store 'org-notmuch-store-link) + + (defun org-notmuch-open (id) + "Visit the notmuch message or thread with id ID." + (notmuch-show id)) + + (defun org-notmuch-store-link () + "Store a link to a notmuch mail message." + (case major-mode + ((notmuch-show-mode notmuch-tree-mode) + ;; Store link to the current message + (let* ((id (notmuch-show-get-message-id)) + (link (concat "notmuch:" id)) + (description (format "Mail: %s" + (notmuch-show-get-subject)))) + (org-store-link-props + :type "notmuch" + :link link + :description description))) + (notmuch-search-mode + ;; Store link to the thread on the current line + (let* ((id (notmuch-search-find-thread-id)) + (link (concat "notmuch:" id)) + (description (format "Mail: %s" + (notmuch-search-find-subject)))) + (org-store-link-props + :type "notmuch" + :link link + :description description))))))) + #+end_src -- cgit v1.2.3