summaryrefslogtreecommitdiffhomepage
path: root/email.org
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2021-04-19 03:54:35 +0100
committerjao <jao@gnu.org>2021-04-19 03:54:54 +0100
commitd8ab09343f5eee14f9e0f104d809273c6d1eea18 (patch)
treeedc6ffe17e38e99c7e6f24033bc48eb422f9e2d9 /email.org
parenta053df6981f436d475424462bbbc0612864a4b5e (diff)
downloadelibs-d8ab09343f5eee14f9e0f104d809273c6d1eea18.tar.gz
elibs-d8ab09343f5eee14f9e0f104d809273c6d1eea18.tar.bz2
notmuch org links
Diffstat (limited to 'email.org')
-rw-r--r--email.org37
1 files changed, 37 insertions, 0 deletions
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