summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2014-10-19 00:43:41 -0400
committerKyle Meyer <kyle@kyleam.com>2014-10-19 00:43:41 -0400
commit4af0bf7a0b91c5a7d72677d76323816166efbc90 (patch)
tree5b61fcc35bdcf708b12c460b7546da616de7c725
parent03a5c24d8c1e23e1948ae4d9c21bd7206ce72de4 (diff)
downloademacs.d-4af0bf7a0b91c5a7d72677d76323816166efbc90.tar.gz
Use notmuch Org links for local mail
-rw-r--r--lisp/init-gnus.el18
1 files changed, 18 insertions, 0 deletions
diff --git a/lisp/init-gnus.el b/lisp/init-gnus.el
index 95ed897..1e6a783 100644
--- a/lisp/init-gnus.el
+++ b/lisp/init-gnus.el
@@ -116,6 +116,7 @@ A new buffer with the patch contents is opened in another window."
(require 'notmuch)
(require 'org-gnus)
+(require 'org-notmuch)
(setq org-gnus-prefer-web-links t)
@@ -146,6 +147,23 @@ A new buffer with the patch contents is opened in another window."
(org-gnus-follow-link group message-id))
(message "Couldn't get relevant infos for switching to Gnus."))))
+(defadvice org-store-link (around km/maybe-use-notmuch-link activate)
+ "Use notmuch links for local mail."
+ (save-window-excursion
+ (km/gnus-goto-message-in-notmuch)
+ ad-do-it))
+
+(defun km/gnus-goto-message-in-notmuch ()
+ "Show message in notmuch."
+ (interactive)
+ (if (and (memq major-mode '(gnus-summary-mode gnus-article-mode))
+ (string= (cadr (gnus-find-method-for-group gnus-newsgroup-name))
+ "dov"))
+ (let* ((header (with-current-buffer gnus-summary-buffer
+ (gnus-summary-article-header)))
+ (message-id (org-remove-angle-brackets (mail-header-id header))))
+ (notmuch-show (concat "id:" message-id)))))
+
(define-key notmuch-show-mode-map (kbd "C-c C-c") 'km/notmuch-goto-message-in-gnus)
(add-hook 'gnus-group-mode-hook 'km/notmuch-shortcut)