From 3815e003ffd6ba245938c67f5ecebcdf75e90226 Mon Sep 17 00:00:00 2001 From: jao Date: Thu, 25 Mar 2021 03:40:04 +0000 Subject: jao-org-notes: insert tags interactively --- lib/org/jao-org-notes.el | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'lib/org') diff --git a/lib/org/jao-org-notes.el b/lib/org/jao-org-notes.el index 621ac12..a1b9dbe 100644 --- a/lib/org/jao-org-notes.el +++ b/lib/org/jao-org-notes.el @@ -92,10 +92,12 @@ (org-global-tags-completion-table (directory-files-recursively jao-org-notes-dir ".*\\.org")))) -(defun jao-org-notes--insert-tags () +(defun jao-org-notes--read-tags () (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"))) + (completing-read-multiple "Tags: " jao-org-notes--tags)) + +(defun jao-org-notes--insert-tags () + (insert "#+filetags: " (mapconcat #'identity (jao-org-notes--read-tags) " ") "\n")) (defun jao-org-notes--insert-date () (insert "#+date: ") @@ -132,6 +134,12 @@ (consult-ripgrep jao-org-notes-dir (concat "\\[\\[file:(.*/)?" (regexp-quote (buffer-name))))) +;;;###autoload +(defun jao-org-notes-insert-tags () + "Insert a list of tags at point, with completing read." + (interactive) + (insert (mapconcat 'identity (jao-org-notes--read-tags) " "))) + ;;;###autoload (defun jao-org-notes-insert-link () "Select a note file (with completion) and insert a link to it." -- cgit v1.2.3