summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--lib/doc/jao-org-notes.el16
1 files changed, 14 insertions, 2 deletions
diff --git a/lib/doc/jao-org-notes.el b/lib/doc/jao-org-notes.el
index c690ae2..77cca9e 100644
--- a/lib/doc/jao-org-notes.el
+++ b/lib/doc/jao-org-notes.el
@@ -87,15 +87,27 @@
t)))))
(defvar jao-org-notes--tags nil)
+(defvar jao-org-notes-tags-cache-file "~/.emacs.d/cache/tags.eld")
(defun jao-org-notes--update-tags ()
(message "Updating tags cache...")
(setq jao-org-notes--tags
(org-global-tags-completion-table
- (directory-files-recursively jao-org-notes-dir ".*\\.org"))))
+ (directory-files-recursively jao-org-notes-dir ".*\\.org")))
+ (with-current-buffer (find-file-noselect jao-org-notes-tags-cache-file)
+ (delete-region (point-min) (point-max))
+ (print jao-org-notes--tags (current-buffer))
+ (save-buffer)))
+
+(defun jao-org-notes-read-tags-cache (&optional refresh)
+ (interactive "P")
+ (when refresh (jao-org-notes--update-tags))
+ (or jao-org-notes--tags
+ (setq jao-org-notes--tags
+ (read (find-file-noselect jao-org-notes-tags-cache-file)))))
(defun jao-org-notes--read-tags ()
- (unless jao-org-notes--tags (jao-org-notes--update-tags))
+ (unless jao-org-notes--tags (jao-org-notes-read-tags-cache))
(completing-read-multiple "Tags: " jao-org-notes--tags))
(defun jao-org-notes--insert-tags ()