Function: embark-org--refine-link-type
embark-org--refine-link-type is a byte-compiled function defined in
embark-org.el.
Signature
(embark-org--refine-link-type TYPE TARGET)
Documentation
Refine type of link TARGET if we have more specific actions available.
Source Code
;; Defined in ~/.emacs.d/elpa/embark-20260610.302/embark-org.el
(defun embark-org--refine-link-type (_type target)
"Refine type of link TARGET if we have more specific actions available."
(when (string-match org-link-any-re target)
(let ((target (or (match-string-no-properties 2 target)
(match-string-no-properties 0 target))))
(cond
((string-prefix-p "http" target)
(cons 'org-url-link target))
((string-prefix-p "mailto:" target)
(cons 'org-email-link (string-remove-prefix "mailto:" target)))
((string-prefix-p "file:" target)
(cons 'org-file-link
(replace-regexp-in-string
"::.*" "" (string-remove-prefix "file:" target))))
((string-prefix-p "attachment:" target)
(cons 'org-file-link
(expand-file-name
(replace-regexp-in-string
"::.*" "" (string-remove-prefix "attachment:" target))
(org-attach-dir))))
((string-match-p "^[./]" target)
(cons 'org-file-link (abbreviate-file-name (expand-file-name target))))
((string-prefix-p "elisp:(" target)
(cons 'org-expression-link (string-remove-prefix "elisp:" target)))
((string-prefix-p "elisp:" target)
(cons 'command (string-remove-prefix "elisp:" target)))
(t (cons 'org-link target))))))