diff --git a/org-roam-db.el b/org-roam-db.el index a3403ee..2b5381c 100644 --- a/org-roam-db.el +++ b/org-roam-db.el @@ -416,7 +416,7 @@ first encapsulating ID." ;;;;; Updating (defun org-roam-db-sync (&optional force) - "Build the cache for `org-roam-directory'. + "Synchronize the cache state with the current Org files on-disk. If FORCE, force a rebuild of the cache from scratch." (interactive "P") (when force (delete-file org-roam-db-location)) diff --git a/org-roam.el b/org-roam.el index 720c845..5a0028d 100644 --- a/org-roam.el +++ b/org-roam.el @@ -194,7 +194,7 @@ Like `file-name-extension', but does not strip version number." "Return t if FILE is part of Org-roam system, nil otherwise. If FILE is not specified, use the current buffer's file-path." (when-let ((path (or file - (buffer-base-buffer (buffer-file-name))))) + (buffer-file-name (buffer-base-buffer))))) (save-match-data (and (org-roam--org-file-p path) diff --git a/tests/test-org-roam.el b/tests/test-org-roam.el index 9b05386..7f31e33 100644 --- a/tests/test-org-roam.el +++ b/tests/test-org-roam.el @@ -23,31 +23,16 @@ (require 'buttercup) (require 'org-roam) -(require 'dash) -(defvar test-org-roam-directory (expand-file-name "tests/roam-files") - "Directory containing org-roam test org files.") - -(defun test-org-roam--init () - "." - (let ((original-dir test-org-roam-directory) - (new-dir (expand-file-name (make-temp-name "org-roam") temporary-file-directory))) - (copy-directory original-dir new-dir) - (setq org-roam-directory new-dir) - (org-roam-setup))) - -(defun test-org-roam--teardown () - "." - (org-roam-teardown) - (delete-file org-roam-db-location) - (org-roam-db--close)) - -(describe "test files for org-roam-db-sync" +(describe "org-roam-db-sync" (before-all - (test-org-roam--init)) + (setq org-roam-directory (expand-file-name "tests/roam-files") + org-roam-db-location (expand-file-name "org-roam.db" temporary-file-directory)) + (org-roam-setup)) (after-all - (test-org-roam--teardown)) + (org-roam-teardown) + (delete-file org-roam-db-location)) (it "has the correct number of files" (expect (caar (org-roam-db-query [:select (funcall count) :from files]))