feat(org): introduce doom-executable link type

This commit is contained in:
TEC 2022-10-03 23:52:09 +08:00 committed by Henrik Lissner
parent c26d64c9b9
commit 181540c8b7
2 changed files with 24 additions and 0 deletions

View file

@ -230,6 +230,25 @@ exist, and `org-link' otherwise."
"TODO"
(doom/describe-package (intern-soft pkg)))
;;;###autoload
(defun +org-link--doom-executable-link-activate-fn (start end executable _bracketed-p)
(when buffer-read-only
(let ((found (executable-find executable)))
(add-text-properties
start end
(list 'display
(concat
(propertize
""
'rear-nonsticky t
'display '(raise -0.02)
'face (list :family "all-the-icons"
:height 1.0
:inherit (if found 'success 'error)))
" "
(propertize
executable
'face (if found 'org-verbatim 'default))))))))
;;
;;; Image data functions (for custom inline images)

View file

@ -586,6 +586,11 @@ relative to `org-directory', unless it is an absolute path."
:activate-func #'+org-link--doom-module-link-activate-fn
:face #'+org-link--doom-module-link-face-fn
:eldoc (-eldoc-fn "Doom module" 'org-priority))
(org-link-set-parameters
"doom-executable"
:activate-func #'+org-link--doom-executable-link-activate-fn
;; :help-echo #'doom-docs--help-echo-from-textprop
:face 'org-verbatim)
(org-link-set-parameters
"doom-ref"
:follow (lambda (link)