summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp')
-rw-r--r--lisp/init-gnus.el8
-rw-r--r--lisp/init-org.el15
2 files changed, 16 insertions, 7 deletions
diff --git a/lisp/init-gnus.el b/lisp/init-gnus.el
index 9f2e132..fd02df2 100644
--- a/lisp/init-gnus.el
+++ b/lisp/init-gnus.el
@@ -149,12 +149,6 @@ 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)
@@ -166,6 +160,8 @@ A new buffer with the patch contents is opened in another window."
(message-id (org-remove-angle-brackets (mail-header-id header))))
(notmuch-show (concat "id:" message-id)))))
+(add-hook 'km/org-store-link-hook 'km/gnus-goto-message-in-notmuch)
+
(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)
diff --git a/lisp/init-org.el b/lisp/init-org.el
index 92c033a..af9dc2d 100644
--- a/lisp/init-org.el
+++ b/lisp/init-org.el
@@ -85,7 +85,20 @@
(define-prefix-command 'km/global-org-map)
(global-set-key (kbd "C-c o") 'km/global-org-map)
-(define-key km/global-org-map "l" 'org-store-link)
+(defvar km/org-store-link-hook nil
+ "Hook run before by `km/org-store-link-hook'.
+These are run within a `save-window-excursion' block.")
+
+(defun km/org-store-link ()
+ "Run `km/org-store-link-hook' before `org-store-link'.
+The hook functions and `org-store-link' are called within a
+`save-window-excursion' block."
+ (interactive)
+ (save-window-excursion
+ (run-hooks 'km/org-store-link-hook)
+ (call-interactively 'org-store-link)))
+
+(define-key km/global-org-map "l" 'km/org-store-link)
(define-key km/global-org-map "o" 'org-open-at-point-global)
(define-key km/global-org-map "a" 'org-agenda)
(define-key km/global-org-map "b" 'org-iswitchb)