(fix): fix face-related functionality (#988)
- Ensure `org-roam-store-link-file` has no effect if org-roam-mode is disabled - Remove custom styling for ID links when org-roam-mode is disabled
This commit is contained in:
parent
0443351800
commit
ea4bfbb55d
1 changed files with 12 additions and 7 deletions
19
org-roam.el
19
org-roam.el
|
@ -1015,13 +1015,15 @@ for Org-ref cite links."
|
||||||
target))
|
target))
|
||||||
|
|
||||||
(defun org-roam-store-link-file ()
|
(defun org-roam-store-link-file ()
|
||||||
"Store a link to an `org-roam' file."
|
"Store a link to an Org-roam file."
|
||||||
(when (org-before-first-heading-p)
|
(when (and (bound-and-true-p org-roam-mode)
|
||||||
(when-let ((title (cdr (assoc "TITLE" (org-roam--extract-global-props '("TITLE"))))))
|
(org-roam--org-roam-file-p)
|
||||||
|
(org-before-first-heading-p))
|
||||||
|
(when-let ((titles (org-roam--extract-titles)))
|
||||||
(org-link-store-props
|
(org-link-store-props
|
||||||
:type "file"
|
:type "file"
|
||||||
:link (format "file:%s" (abbreviate-file-name buffer-file-name))
|
:link (format "file:%s" (abbreviate-file-name buffer-file-name))
|
||||||
:description title))))
|
:description (car titles)))))
|
||||||
|
|
||||||
(defun org-roam--store-link (arg &optional interactive?)
|
(defun org-roam--store-link (arg &optional interactive?)
|
||||||
"Store a link to the current location within Org-roam.
|
"Store a link to the current location within Org-roam.
|
||||||
|
@ -1292,8 +1294,9 @@ M-x info for more information at Org-roam > Installation > Post-Installation Tas
|
||||||
(add-hook 'org-open-at-point-functions #'org-roam-open-id-at-point)
|
(add-hook 'org-open-at-point-functions #'org-roam-open-id-at-point)
|
||||||
(advice-add 'rename-file :after #'org-roam--rename-file-advice)
|
(advice-add 'rename-file :after #'org-roam--rename-file-advice)
|
||||||
(advice-add 'delete-file :before #'org-roam--delete-file-advice)
|
(advice-add 'delete-file :before #'org-roam--delete-file-advice)
|
||||||
(org-link-set-parameters "file" :face 'org-roam--file-link-face :store #'org-roam-store-link-file)
|
(when (fboundp 'org-link-set-parameters)
|
||||||
(org-link-set-parameters "id" :face 'org-roam---id-link-face)
|
(org-link-set-parameters "file" :face 'org-roam--file-link-face :store #'org-roam-store-link-file)
|
||||||
|
(org-link-set-parameters "id" :face 'org-roam---id-link-face))
|
||||||
(org-roam-db-build-cache))
|
(org-roam-db-build-cache))
|
||||||
(t
|
(t
|
||||||
(setq org-execute-file-search-functions (delete 'org-roam--execute-file-row-col org-execute-file-search-functions))
|
(setq org-execute-file-search-functions (delete 'org-roam--execute-file-row-col org-execute-file-search-functions))
|
||||||
|
@ -1302,7 +1305,9 @@ M-x info for more information at Org-roam > Installation > Post-Installation Tas
|
||||||
(remove-hook 'org-open-at-point-functions #'org-roam-open-id-at-point)
|
(remove-hook 'org-open-at-point-functions #'org-roam-open-id-at-point)
|
||||||
(advice-remove 'rename-file #'org-roam--rename-file-advice)
|
(advice-remove 'rename-file #'org-roam--rename-file-advice)
|
||||||
(advice-remove 'delete-file #'org-roam--delete-file-advice)
|
(advice-remove 'delete-file #'org-roam--delete-file-advice)
|
||||||
(org-link-set-parameters "file" :face 'org-link)
|
(when (fboundp 'org-link-set-parameters)
|
||||||
|
(dolist (face '("file" "id"))
|
||||||
|
(org-link-set-parameters face :face 'org-link)))
|
||||||
(org-roam-db--close-all)
|
(org-roam-db--close-all)
|
||||||
;; Disable local hooks for all org-roam buffers
|
;; Disable local hooks for all org-roam buffers
|
||||||
(dolist (buf (org-roam--get-roam-buffers))
|
(dolist (buf (org-roam--get-roam-buffers))
|
||||||
|
|
Loading…
Reference in a new issue