From d8ab09343f5eee14f9e0f104d809273c6d1eea18 Mon Sep 17 00:00:00 2001 From: jao Date: Mon, 19 Apr 2021 03:54:35 +0100 Subject: notmuch org links --- email.org | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'email.org') diff --git a/email.org b/email.org index bf21157..60900d2 100644 --- a/email.org +++ b/email.org @@ -342,6 +342,43 @@ (("h" . jao-notmuch-goto-message-buffer) ("k" . jao-notmuch-tag-jump)))) #+end_src +*** org mode integration + 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 *** tag shell script #+begin_src bash :tangle ./bin/notmuch-tags.sh :tangle-mode (identity #o755) notmuch new > $HOME/var/log/notmuch.log 2>&1 -- cgit v1.2.3