From e5f281c982db78ccb31d54d0d13f4c17a093c318 Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Fri, 6 Dec 2024 09:59:35 +0200 Subject: journal: Add multiple template options. --- org-gnosis.el | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'org-gnosis.el') 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." -- cgit v1.2.3