(feat): Implement new face-toggle for id-links (#999)

Also fix a typo.
This commit is contained in:
Leo Vivier 2020-08-04 15:26:51 +02:00 committed by GitHub
parent f206b5bbf9
commit f18ecd1fc3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1132,15 +1132,21 @@ Applies `org-roam-link-current' if ID corresponds to the
currently opened Org-roam file in the backlink buffer, or
`org-roam-link-face' if ID corresponds to any other Org-roam
file."
(cond ((not (org-roam-id-find id))
'org-roam-link-invalid)
((and (org-roam--in-buffer-p)
(org-roam--backlink-to-current-p))
'org-roam-link-current)
((org-roam-id-find id t)
'org-roam-link)
(t
'org-link)))
(let* ((in-note (-> (buffer-file-name (buffer-base-buffer))
(org-roam--org-roam-file-p)))
(custom (or (and in-note org-roam-link-use-custom-faces)
(eq org-roam-link-use-custom-faces 'everywhere))))
(cond ((and custom
(not (org-roam-id-find id)))
'org-roam-link-invalid)
((and (org-roam--in-buffer-p)
(org-roam--backlink-to-current-p))
'org-roam-link-current)
((and custom
(org-roam-id-find id))
'org-roam-link)
(t
'org-link))))
;;;; Hooks and Advices
(defun org-roam--find-file-hook-function ()
@ -1303,7 +1309,7 @@ M-x info for more information at Org-roam > Installation > Post-Installation Tas
(advice-add 'delete-file :before #'org-roam--delete-file-advice)
(when (fboundp 'org-link-set-parameters)
(org-link-set-parameters "file" :face 'org-roam--file-link-face :store #'org-roam-store-link)
(org-link-set-parameters "id" :face 'org-roam---id-link-face))
(org-link-set-parameters "id" :face 'org-roam--id-link-face))
(org-roam-db-build-cache))
(t
(setq org-execute-file-search-functions (delete 'org-roam--execute-file-row-col org-execute-file-search-functions))