summaryrefslogtreecommitdiff
path: root/org-gnosis.el
diff options
context:
space:
mode:
authorThanos Apollo <[email protected]>2024-12-06 09:59:35 +0200
committerThanos Apollo <[email protected]>2024-12-06 09:59:35 +0200
commite5f281c982db78ccb31d54d0d13f4c17a093c318 (patch)
treef67ca0d5e3669d58a8bae5c049fb6cd3a27ea437 /org-gnosis.el
parentce582310379d7dff44211e40040728c1ed957aad (diff)
journal: Add multiple template options.
Diffstat (limited to 'org-gnosis.el')
-rw-r--r--org-gnosis.el15
1 files changed, 12 insertions, 3 deletions
diff --git a/org-gnosis.el b/org-gnosis.el
index 97bca05..a3db8be 100644
--- a/org-gnosis.el
+++ b/org-gnosis.el
@@ -41,8 +41,9 @@
:type 'directory
:group 'org-gnosis)
-(defcustom org-gnosis-journal-template
- "* Daily Notes\n\n* Goals\n+ []"
+(defcustom org-gnosis-journal-templates
+ '(("default" "* Daily Notes\n\n* Goals\n+ []")
+ ("Empty" ""))
"Template for journaling."
:type 'string
:group 'org-gnosis)
@@ -397,6 +398,14 @@ instead."
(ignore-errors (org-id-goto id))
(org-gnosis-mode 1)))))
+(defun org-gnosis-journal-select-template (&optional templates)
+ "Selecte journal template from TEMPLATES."
+ (let* ((templates (or templates org-gnosis-journal-templates))
+ (selected (funcall org-gnosis-completing-read-func "Select template:"
+ (mapcar #'car templates)))
+ (template (cdr (assoc selected templates))))
+ (apply #'append template)))
+
;;;###autoload
(defun org-gnosis-insert ()
"Insert gnosis node."
@@ -436,7 +445,7 @@ instead."
(let* ((date (format-time-string "%Y-%m-%d"))
(file (format "%s.org" date)))
(org-gnosis--create-file date (expand-file-name file org-gnosis-journal-dir)
- (or template org-gnosis-journal-template))))
+ (or template (org-gnosis-journal-select-template)))))
(define-minor-mode org-gnosis-mode
"Org gnosis mode."