mu4e-org: Don't trigger errors outside mu4e
The functions only work when in mu4e-view-mode/mu4e-headers-mode, which implies that mu4e is already loaded. So no need to check. Fixes #1829.
This commit is contained in:
@ -59,8 +59,6 @@ the current query; otherwise, it links to the message at point.")
|
|||||||
|
|
||||||
(defun mu4e~org-store-link-message ()
|
(defun mu4e~org-store-link-message ()
|
||||||
"Store a link to a mu4e message."
|
"Store a link to a mu4e message."
|
||||||
(unless (fboundp 'mu4e-message-at-point)
|
|
||||||
(error "Please load mu4e before mu4e-org"))
|
|
||||||
(setq org-store-link-plist nil)
|
(setq org-store-link-plist nil)
|
||||||
(let* ((msg (mu4e-message-at-point))
|
(let* ((msg (mu4e-message-at-point))
|
||||||
(from (car-safe (plist-get msg :from)))
|
(from (car-safe (plist-get msg :from)))
|
||||||
@ -88,14 +86,13 @@ It links to the last known query when in `mu4e-headers-mode' with
|
|||||||
`mu4e-org-link-query-in-headers-mode' set; otherwise it links to
|
`mu4e-org-link-query-in-headers-mode' set; otherwise it links to
|
||||||
a specific message, based on its message-id, so that links stay
|
a specific message, based on its message-id, so that links stay
|
||||||
valid even after moving the message around."
|
valid even after moving the message around."
|
||||||
(unless (fboundp 'mu4e-message-at-point)
|
(when (derived-mode-p '(mu4e-view-mode mu4e-headers-mode))
|
||||||
(error "Please load mu4e before mu4e-org"))
|
(if (and (derived-mode-p '(mu4e-headers-mode))
|
||||||
(if (and (eq major-mode 'mu4e-headers-mode)
|
mu4e-org-link-query-in-headers-mode)
|
||||||
mu4e-org-link-query-in-headers-mode)
|
(mu4e~org-store-link-query)
|
||||||
(mu4e~org-store-link-query)
|
(when (mu4e-message-at-point)
|
||||||
(when (mu4e-message-at-point t)
|
(mu4e~org-store-link-message)))))
|
||||||
(mu4e~org-store-link-message))))
|
;
|
||||||
;
|
|
||||||
(defun mu4e-org-open (link)
|
(defun mu4e-org-open (link)
|
||||||
"Open the org LINK.
|
"Open the org LINK.
|
||||||
Open the mu4e message (for links starting with 'msgid:') or run
|
Open the mu4e message (for links starting with 'msgid:') or run
|
||||||
|
|||||||
Reference in New Issue
Block a user