aboutsummaryrefslogtreecommitdiffstats
path: root/oni-org
diff options
context:
space:
mode:
Diffstat (limited to 'oni-org')
-rw-r--r--oni-org/oni-org.el18
1 files changed, 17 insertions, 1 deletions
diff --git a/oni-org/oni-org.el b/oni-org/oni-org.el
index 6dd9c66..400a569 100644
--- a/oni-org/oni-org.el
+++ b/oni-org/oni-org.el
@@ -4,7 +4,7 @@
;; Author: Tom Willemse <tom@ryuslash.org>
;; Keywords: local
-;; Version: 2023.0517.001154
+;; Version: 2023.0526.234458
;; Package-Requires: (oni-yasnippet oni-alert oni-hydra org org-bullets org-edna diminish all-the-icons olivetti form-feed org-pretty-table)
;; This program is free software; you can redistribute it and/or modify
@@ -1192,5 +1192,21 @@ placed above TARGET. Otherwise it will be placed below it."
(insert "\n"))
(goto-char (point-min))))
+;;; Add face to file links that show file doesn't exist.
+
+(defface oni-org-link-nonexitent-file
+ '((t :inherit error :underline t :weight regular))
+ "Face to display links that point to nonexistent files in.")
+
+(defun oni-org-file-face-selector (path)
+ "Return a different face based on whether PATH exists or not.
+When PATH exists just return the face ‘org-link’ as usual,
+otherwise return ‘oni-org-link-nonexistent-file’."
+ (if (file-exists-p path)
+ 'org-link
+ 'oni-org-link-nonexistent-file))
+
+(org-link-set-parameters "file" :face #'oni-org-file-face-selector)
+
(provide 'oni-org)
;;; oni-org.el ends here