summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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)