summaryrefslogtreecommitdiffhomepage
path: root/notmuch.org
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2021-07-04 03:21:13 +0100
committerjao <jao@gnu.org>2021-07-04 03:21:13 +0100
commit8d69ec9c7ac4b4ee8a9a2df244ac6130a66979a9 (patch)
treee809117e365791769fc044ca0ee2025fb1572cf8 /notmuch.org
parent79381fcbd6892b4cf3ef43dca46a61a8a5da1cee (diff)
downloadelibs-8d69ec9c7ac4b4ee8a9a2df244ac6130a66979a9.tar.gz
elibs-8d69ec9c7ac4b4ee8a9a2df244ac6130a66979a9.tar.bz2
recovering explicit org-notmuch integration
Diffstat (limited to 'notmuch.org')
-rw-r--r--notmuch.org42
1 files changed, 37 insertions, 5 deletions
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