diff --git a/org/config-org-capture.el b/org/config-org-capture.el index 7437642..d161bf3 100644 --- a/org/config-org-capture.el +++ b/org/config-org-capture.el @@ -1,6 +1,35 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; inspiration for conditional capture template : https://storax.github.io/blog/2016/05/02/org-capture-tricks/ + +; helper functions +(defvar oc-capture-prmt-history nil + "History of prompt answers for org capture.") +(defun oc/prmt (prompt variable) + "PROMPT for string, save it to VARIABLE and insert it." + (make-local-variable variable) + (set variable (read-string (concat prompt ": ") nil oc-capture-prmt-history))) +(defun oc/inc (what text &rest fmtvars) + "Ask user to include WHAT. If user agrees return TEXT." + (when (y-or-n-p (concat "Include " what "?")) + (apply 'format text fmtvars))) +(defun oc/inc (what text &rest fmtvars) + "Ask user to include WHAT. If user agrees return TEXT." + (when (y-or-n-p (concat "Include " what "?")) + (apply 'format text fmtvars))) +(defun oc/inc_date (what prefix) + "Ask user to include a date. If user agrees prompt for date." + (when (y-or-n-p (concat "Include " what "?")) + (concat prefix (org-time-stamp nil)))) + ; orgmode capture templates (setq org-capture-templates '( + ("d" "TODO" entry + (file+headline "~/org/_todo.org" "Active") + (file "~/org/template_todo.org") + :prepend t + :immediate-finish "f" + :jump-to-captured "t" + ) ("b" "Blog Post" entry (file+headline "~/org/blog/_blog.org" "Drafts") (file "~/org/template_blog.org")