From 6494952912896c8f35be4873463955ce811ce8a2 Mon Sep 17 00:00:00 2001 From: stardiviner Date: Wed, 10 Jul 2024 13:01:11 +0800 Subject: [PATCH] add a command for manually update org-bookmarks database cache --- org-bookmarks.el | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/org-bookmarks.el b/org-bookmarks.el index e3b61d6..f0cdbc7 100644 --- a/org-bookmarks.el +++ b/org-bookmarks.el @@ -154,14 +154,19 @@ Or you can add org-capture template by yourself." (user-error "File does not exist: %S" file))) (defvar org-bookmarks--candidates-cache nil - "A cache variable of org-bookmarks--candidates.") + "A cache variable of `org-bookmarks--candidates'.") + +(defun org-bookmarks-db-update-cache () + "Update the `org-bookmarks' database cache." + (interactive) + (setq org-bookmarks--candidates-cache (org-bookmarks--return-candidates))) ;;;###autoload (defun org-bookmarks (&optional file) "Open bookmark read from FILE or `org-bookmarks-file'." (interactive) (unless org-bookmarks--candidates-cache - (setq org-bookmarks--candidates-cache (org-bookmarks--return-candidates))) + (org-bookmarks-db-update-cache)) (if-let* ((file (or file org-bookmarks-file)) ( (file-exists-p file))) (if-let* ((candidates org-bookmarks--candidates-cache) -- 2.11.4.GIT