add todo capture template that can have scheduled/deadline dates set via y/n/date prompts. see below for example template
** TODO [#%(oc/prmt `"Priority (A-F)`" 'td-priority)] %(oc/prmt `"Title`" 'td-title) %(oc/inc_date `"scheduled date`" `"SCHEDULED: `") %(oc/inc_date `"deadline date`" `"DEADLINE: `") %?
This commit is contained in:
parent
0f9321008e
commit
3289b8a202
|
@ -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")
|
||||
|
|
Reference in a new issue