From cffa0bd201c905c4abdb4451ad91d8340662ffe4 Mon Sep 17 00:00:00 2001 From: Herbert Jones Date: Sun, 25 Oct 2020 22:22:40 -0500 Subject: [PATCH] (fix): support multidir with dirty db flag (#1216) --- org-roam-db.el | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/org-roam-db.el b/org-roam-db.el index 089f6a9..cea737d 100644 --- a/org-roam-db.el +++ b/org-roam-db.el @@ -85,7 +85,9 @@ value like `most-positive-fixnum'." "Database connection to Org-roam database.") (defvar org-roam-db-dirty nil - "Whether the org-roam database is dirty and requires an update.") + "Whether the org-roam database is dirty and requires an update. +Contains pairs of `org-roam-directory' and `org-roam-db-location' +so that multi-directories are updated.") ;;;; Core Functions @@ -196,7 +198,8 @@ the current `org-roam-directory'." (defun org-roam-db--mark-dirty () "Mark the Org-roam database as dirty." - (setq org-roam-db-dirty t)) + (add-to-list 'org-roam-db-dirty (list org-roam-directory org-roam-db-location) + nil #'equal)) ;;;; Database API ;;;;; Initialization @@ -548,9 +551,9 @@ If FORCE, force a rebuild of the cache from scratch." (defun org-roam-db-update-cache () "Update the cache if the database is dirty." - (when org-roam-db-dirty - (org-roam-db-build-cache) - (setq org-roam-db-dirty nil))) + (pcase-dolist (`(,org-roam-directory ,org-roam-db-location) org-roam-db-dirty) + (org-roam-db-build-cache)) + (setq org-roam-db-dirty nil)) (provide 'org-roam-db)