summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2021-03-25 03:40:04 +0000
committerjao <jao@gnu.org>2021-03-25 03:40:04 +0000
commit3815e003ffd6ba245938c67f5ecebcdf75e90226 (patch)
treeacb13a6f45d174583dfe085ef63c5fbfb6d203bb
parente83f44570d456fb37342f97ed30a6cc01ecfd843 (diff)
downloadelibs-3815e003ffd6ba245938c67f5ecebcdf75e90226.tar.gz
elibs-3815e003ffd6ba245938c67f5ecebcdf75e90226.tar.bz2
jao-org-notes: insert tags interactively
-rw-r--r--lib/org/jao-org-notes.el14
-rw-r--r--org.org1
2 files changed, 12 insertions, 3 deletions
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: ")
@@ -133,6 +135,12 @@
(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."
(interactive)
diff --git a/org.org b/org.org
index 993c6b3..ef26654 100644
--- a/org.org
+++ b/org.org
@@ -216,6 +216,7 @@
(major-mode-hydra-define+ org-mode ()
("Notes"
(("i" jao-org-notes-insert-link "insert link")
+ ("t" jao-org-notes-insert-tags "insert tags")
("o" jao-org-notes-open "find and open note")
("c" jao-org-notes-open-or-create "open or create note")
("v" jao-org-notes-backlinks "show backlinks"))))