mirror of
https://github.com/org-roam/org-roam
synced 2025-08-01 12:17:21 -05:00
(fix): support multidir with dirty db flag (#1216)
This commit is contained in:
@ -85,7 +85,9 @@ value like `most-positive-fixnum'."
|
|||||||
"Database connection to Org-roam database.")
|
"Database connection to Org-roam database.")
|
||||||
|
|
||||||
(defvar org-roam-db-dirty nil
|
(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
|
;;;; Core Functions
|
||||||
|
|
||||||
@ -196,7 +198,8 @@ the current `org-roam-directory'."
|
|||||||
|
|
||||||
(defun org-roam-db--mark-dirty ()
|
(defun org-roam-db--mark-dirty ()
|
||||||
"Mark the Org-roam database as 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
|
;;;; Database API
|
||||||
;;;;; Initialization
|
;;;;; Initialization
|
||||||
@ -548,9 +551,9 @@ If FORCE, force a rebuild of the cache from scratch."
|
|||||||
|
|
||||||
(defun org-roam-db-update-cache ()
|
(defun org-roam-db-update-cache ()
|
||||||
"Update the cache if the database is dirty."
|
"Update the cache if the database is dirty."
|
||||||
(when org-roam-db-dirty
|
(pcase-dolist (`(,org-roam-directory ,org-roam-db-location) org-roam-db-dirty)
|
||||||
(org-roam-db-build-cache)
|
(org-roam-db-build-cache))
|
||||||
(setq org-roam-db-dirty nil)))
|
(setq org-roam-db-dirty nil))
|
||||||
|
|
||||||
(provide 'org-roam-db)
|
(provide 'org-roam-db)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user