From 4af0bf7a0b91c5a7d72677d76323816166efbc90 Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Sun, 19 Oct 2014 00:43:41 -0400 Subject: Use notmuch Org links for local mail --- lisp/init-gnus.el | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'lisp') 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) -- cgit v1.2.3