lang/org: Support option in custom org links

This commit is contained in:
How Si Wei 2020-05-22 22:11:14 +08:00
parent a262527a7f
commit 88903551c0

View file

@ -32,9 +32,12 @@ exist, and `org-link' otherwise."
:follow (lambda (link) :follow (lambda (link)
(org-link-open-as-file (expand-file-name link (funcall dir-fn)) nil)) (org-link-open-as-file (expand-file-name link (funcall dir-fn)) nil))
:face (lambda (link) :face (lambda (link)
(if (file-exists-p (expand-file-name link (funcall dir-fn))) (let* ((path (expand-file-name link (funcall dir-fn)))
'org-link (option-index (string-match-p "::\\(.*\\)\\'" path))
'error)) (file-name (substring path 0 option-index)))
(if (file-exists-p file-name)
'org-link
'error)))
(doom-plist-delete plist :requires)))) (doom-plist-delete plist :requires))))