diff options
author | jao <jao@gnu.org> | 2021-03-02 05:39:41 +0000 |
---|---|---|
committer | jao <jao@gnu.org> | 2021-03-02 05:40:12 +0000 |
commit | 93acd981eddb8add92453559885a14e47b301651 (patch) | |
tree | 7b7a56424a4982274dc0f1ac2591d20857d4d5ef | |
parent | 2f73af43db9de972c0ec61bbebc06e1d95079631 (diff) | |
download | elibs-93acd981eddb8add92453559885a14e47b301651.tar.gz elibs-93acd981eddb8add92453559885a14e47b301651.tar.bz2 |
jao-org-notes: tag collection
-rw-r--r-- | lib/org/jao-org-notes.el | 15 |
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)) |