summaryrefslogtreecommitdiffhomepage
path: root/eos
diff options
context:
space:
mode:
Diffstat (limited to 'eos')
-rw-r--r--eos/jao-embark-targets.el18
1 files changed, 18 insertions, 0 deletions
diff --git a/eos/jao-embark-targets.el b/eos/jao-embark-targets.el
index 0461769..1887b79 100644
--- a/eos/jao-embark-targets.el
+++ b/eos/jao-embark-targets.el
@@ -27,6 +27,24 @@
(require 'embark)
(declare-function w3m-anchor "w3m")
+(declare-function org-link-any-re "ol")
+(declare-function org-open-link-from-string "ol")
+(declare-function org-in-regexp "org-macs")
+
+(defun jao-embark-targets--org-link ()
+ (when (derived-mode-p 'org-mode)
+ (when (org-in-regexp org-link-any-re)
+ (let ((lnk (match-string-no-properties 2)))
+ (if (string-match-p "http://.+" lnk)
+ (cons 'url lnk)
+ (cons 'org-link (match-string-no-properties 0)))))))
+
+(embark-define-keymap jao-embark-targets-org-link-map
+ "Actions for org links"
+ ((kbd "RET") org-open-link-from-string))
+
+(add-to-list 'embark-target-finders #'jao-embark-targets--org-link)
+(add-to-list 'embark-keymap-alist '(org-link . jao-embark-targets-org-link-map))
(defvar jao-embark-targets-video-url-rx
(format "^https?://\\(?:www\\.\\)?%s/.+"