From 9e0d7da6a10af00c7c0502b135ce61424412989c Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Fri, 6 Dec 2024 15:44:48 +0200 Subject: Add insert-tag --- org-gnosis.el | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'org-gnosis.el') diff --git a/org-gnosis.el b/org-gnosis.el index 0291cc1..e93dde2 100644 --- a/org-gnosis.el +++ b/org-gnosis.el @@ -376,6 +376,22 @@ instead." (id (concat "id:" (car (org-gnosis-select 'id 'nodes `(= ,node title) '1=1))))) (org-insert-link nil id node))) +;;;###autoload +(defun org-gnosis-insert-tag () + "Insert filetag." + (interactive) + (let* ((filetags (org-gnosis-select 'tag 'tags '1=1 t)) + (tag (funcall org-gnosis-completing-read-func "Select tag: " filetags))) + (save-excursion + (goto-char (point-min)) + (if (re-search-forward "^#\\+FILETAGS:" nil t) + (progn + (end-of-line) + (insert (if (looking-back ":" nil) "" ":") tag ":")) + (progn + (insert "#+FILETAGS: :" tag ":") + (newline)))))) + ;;;###autoload (defun org-gnosis-journal-find (&optional date) "Find journal entry for DATE." -- cgit v1.2.3