(feat): add prefix argument to force database rebuild (#553)

* (feat): add prefix argument to force database rebuild

* Update changelog
This commit is contained in:
Jethro Kuan
2020-05-03 18:40:32 +08:00
committed by GitHub
parent 4cad2cf6e6
commit 69d4f05a13
2 changed files with 7 additions and 4 deletions

View File

@@ -13,6 +13,7 @@
### Features
* [#538](https://github.com/jethrokuan/org-roam/pull/538) Optionally use text in first headline as title
* [#553](https://github.com/jethrokuan/org-roam/pull/553) Add prefix argument to `org-roam-db-build-cache` for forcing rebuilds
## 1.1.0 (21-04-2020)

View File

@@ -342,9 +342,11 @@ including the file itself. If the file does not have any connections, nil is re
(org-roam-db--update-cache-links)
(org-roam-buffer--update-maybe :redisplay t))))))
(defun org-roam-db-build-cache ()
"Build the cache for `org-roam-directory'."
(interactive)
(defun org-roam-db-build-cache (&optional force)
"Build the cache for `org-roam-directory'.
If FORCE, force a rebuild of the cache from scratch."
(interactive "P")
(when force (delete-file (org-roam-db--get)))
(org-roam-db--close) ;; Force a reconnect
(org-roam-db) ;; To initialize the database, no-op if already initialized
(let* ((org-roam-files (org-roam--list-all-files))