branch: externals/org-gnosis
commit 9e0d7da6a10af00c7c0502b135ce61424412989c
Author: Thanos Apollo <[email protected]>
Commit: Thanos Apollo <[email protected]>
Add insert-tag
---
org-gnosis.el | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/org-gnosis.el b/org-gnosis.el
index 0291cc1630..e93dde2978 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."