diff options
author | jao <jao@gnu.org> | 2021-01-30 05:15:10 +0000 |
---|---|---|
committer | jao <jao@gnu.org> | 2021-01-30 05:15:10 +0000 |
commit | c1649be9e82738e76967a5995e3e4890cf35170c (patch) | |
tree | 23faf1e799fda394a487e1c8a6aa760dc6ca5998 /eos | |
parent | 52f9319be526c255059fca3f721af8ac7a11abf8 (diff) | |
download | elibs-c1649be9e82738e76967a5995e3e4890cf35170c.tar.gz elibs-c1649be9e82738e76967a5995e3e4890cf35170c.tar.bz2 |
embark targts: org links
Diffstat (limited to 'eos')
-rw-r--r-- | eos/jao-embark-targets.el | 18 |
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/.+" |