[oni-org] Change the way file links are displayed in org-mode
If a file link points to a file that doesn't exist, display it similarly to an error.
This commit is contained in:
parent
ec54fa9d04
commit
dd2bbeb47b
1 changed files with 17 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue