From a03ad54460745cb02acd326d71096e4c88f9576b Mon Sep 17 00:00:00 2001 From: Jethro Kuan Date: Sun, 1 Mar 2020 02:42:55 +0800 Subject: [PATCH] (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 --- org-roam.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/org-roam.el b/org-roam.el index d32206d..31a63e0 100644 --- a/org-roam.el +++ b/org-roam.el @@ -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."