summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--lib/org/jao-org-notes.el15
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/org/jao-org-notes.el b/lib/org/jao-org-notes.el
index 3c3a134..e2b3a3c 100644
--- a/lib/org/jao-org-notes.el
+++ b/lib/org/jao-org-notes.el
@@ -25,6 +25,7 @@
;;; Code:
(require 'org)
+(require 'consult)
(defvar jao-org-notes-dir (expand-file-name "notes" org-directory))
@@ -49,10 +50,17 @@
(insert "#+title: " title "\n")
t)))))
+(defvar jao-org-notes--tags nil)
+
+(defun jao-org-notes--update-tags ()
+ (setq jao-org-notes--tags
+ (org-global-tags-completion-table
+ (directory-files-recursively jao-org-notes-dir ".*\\.org"))))
+
(defun jao-org-notes--insert-tags ()
- (let ((ts (completing-read-multiple "Tags: "
- (org-global-tags-completion-table))))
- (insert "#+filetags:" ":" (mapconcat 'identity ts ":") ":\n")))
+ (unless jao-org-notes--tags (jao-org-notes--update-tags))
+ (let ((ts (completing-read-multiple "Tags: " jao-org-notes--tags)))
+ (insert "#+filetags: " (mapconcat 'identity ts " ") "\n")))
(defun jao-org-notes--insert-date ()
(insert "#+date: ")
@@ -109,6 +117,7 @@
(when (jao-org-notes--insert-title)
(jao-org-notes--insert-date)
(jao-org-notes--insert-tags)
+ (jao-org-notes--update-tags)
(insert "#+link: "))
(save-buffer)
(buffer-file-name))