(bugfix): fix org-roam-delete-file-advice triggering on non-org-roam files (#211)

Adding a predicate for the delete-file advice ensures that expensive
SQL operations do not run when not necessary
This commit is contained in:
Jethro Kuan
2020-03-01 02:42:55 +08:00
committed by GitHub
parent a88076a704
commit a03ad54460

View File

@@ -791,7 +791,9 @@ This sets `file:' Org links to have the org-link face."
(defun org-roam--delete-file-advice (file &optional _trash)
"Advice for maintaining cache consistency during file deletes."
(org-roam--db-clear-file (file-truename file)))
(when (and (not (auto-save-file-name-p file))
(org-roam--org-roam-file-p file))
(org-roam--db-clear-file (file-truename file))))
(defun org-roam--rename-file-advice (file new-file &rest args)
"Rename backlinks of FILE to refer to NEW-FILE."