REF clean up property code
This commit is contained in:
parent
ecf6ebbab0
commit
f07867c3c1
28
etc/conf.org
28
etc/conf.org
|
@ -2233,11 +2233,20 @@ Also here are the properties for repeated tasks and a few others (see comments i
|
|||
org-x-prop-time-shift))
|
||||
|
||||
(let ((effort-choices (list "0:05" "0:15" "0:30" "1:00" "1:30" "2:00" "3:00"
|
||||
"4:00" "5:00" "6:00")))
|
||||
"4:00" "5:00" "6:00"))
|
||||
(parent-type-choices (list org-x-prop-parent-type-periodical
|
||||
org-x-prop-parent-type-iterator))
|
||||
(routine-choices (list org-x-prop-routine-morning
|
||||
org-x-prop-routine-evening)))
|
||||
(cl-flet
|
||||
((def-choices
|
||||
(prop options &optional allow-other)
|
||||
(let ((options* (if allow-other (-snoc options ":ETC") options)))
|
||||
(cons (format "%s_ALL" prop) (s-join " " options*)))))
|
||||
(setq org-global-properties
|
||||
(list org-x-prop-parent-type-choices
|
||||
(org-x-define-prop-choices org-effort-property effort-choices t)
|
||||
org-x-prop-routine-choices)))
|
||||
(list (def-choices org-x-prop-parent-type parent-type-choices)
|
||||
(def-choices org-effort-property effort-choices t)
|
||||
(def-choices org-x-prop-routine routine-choices)))))
|
||||
#+END_SRC
|
||||
*** capture
|
||||
**** templates
|
||||
|
@ -2610,11 +2619,13 @@ original org entry before executing BODY."
|
|||
(org-super-agenda-groups
|
||||
`((:name "Morning routine"
|
||||
:pred ,(nd/org-x-mk-super-agenda-pred
|
||||
(equal "morning" (org-entry-get nil org-x-prop-routine)))
|
||||
(org-x-headline-has-property org-x-prop-routine
|
||||
org-x-prop-routine-morning))
|
||||
:order 0)
|
||||
(:name "Evening routine"
|
||||
:pred ,(nd/org-x-mk-super-agenda-pred
|
||||
(equal "evening" (org-entry-get nil org-x-prop-routine)))
|
||||
(org-x-headline-has-property org-x-prop-routine
|
||||
org-x-prop-routine-evening))
|
||||
:order 3)
|
||||
(:name "Calendar" :order 1 :time-grid t)
|
||||
(:name "Habits" :order 6 :habit t)
|
||||
|
@ -2862,8 +2873,9 @@ original org entry before executing BODY."
|
|||
(not (org-x-is-created-heading-p))))))
|
||||
(:name "Missing Archive Target (iterators)" :pred
|
||||
,(nd/org-x-mk-super-agenda-pred
|
||||
(and (equal "iterator" (org-entry-get nil org-x-prop-parent-type))
|
||||
(not (org-entry-get nil "ARCHIVE")))))
|
||||
(and (org-x-headline-has-property
|
||||
org-x-prop-parent-type org-x-prop-parent-type-iterator)
|
||||
(org-x-headline-has-property "ARCHIVE" nil))))
|
||||
(:name "Future Creation Timestamp" :pred
|
||||
,(nd/org-x-mk-super-agenda-pred
|
||||
;; TODO extend this to non-todoitems
|
||||
|
|
|
@ -78,7 +78,7 @@
|
|||
"Prefix character denoting life category tag.")
|
||||
|
||||
(defconst org-x-tag-errand
|
||||
(org-x-prepend-char org-x-tag-location-prefix "errand")
|
||||
(org-x-prepend-char org-x-tag-location-prefix "errand")
|
||||
"Tag denoting an errand location.")
|
||||
|
||||
(defconst org-x-tag-home
|
||||
|
@ -165,19 +165,17 @@
|
|||
|
||||
;;; PROPERTIES
|
||||
|
||||
(eval-and-compile
|
||||
(defun org-x-define-prop-choices (prop options &optional allow-other)
|
||||
(let ((options* (if allow-other (-snoc options ":ETC") options)))
|
||||
(cons (format "%s_ALL" prop) (s-join " " options*)))))
|
||||
;; all follow the nomenclature `org-x-prop-PROPNAME' (key) or
|
||||
;; `org-x-prop-PROPNAME-VALNAME' (value)
|
||||
|
||||
(eval-and-compile
|
||||
(defconst org-x-prop-parent-type "PARENT_TYPE"
|
||||
"Property denoting iterator/periodical headline."))
|
||||
(defconst org-x-prop-parent-type "PARENT_TYPE"
|
||||
"Property denoting iterator/periodical headline.")
|
||||
|
||||
(eval-and-compile
|
||||
(defconst org-x-prop-parent-type-choices
|
||||
(org-x-define-prop-choices org-x-prop-parent-type '("periodical" "iterator"))
|
||||
"Choices for `org-x-prop-parent-type'."))
|
||||
(defconst org-x-prop-parent-type-periodical "periodical"
|
||||
"Property value for a periodical parent type.")
|
||||
|
||||
(defconst org-x-prop-parent-type-iterator "iterator"
|
||||
"Property value for an iterator parent type.")
|
||||
|
||||
(defconst org-x-prop-time-shift "TIME_SHIFT"
|
||||
"Property denoting time shift when cloning iterator/periodical headlines.")
|
||||
|
@ -186,14 +184,14 @@
|
|||
(defconst org-x-prop-thread "THREAD"
|
||||
"Property denoting an email thread to track.")
|
||||
|
||||
(eval-and-compile
|
||||
(defconst org-x-prop-routine "X-ROUTINE"
|
||||
"Property denoting a routine group."))
|
||||
(defconst org-x-prop-routine "X-ROUTINE"
|
||||
"Property denoting a routine group.")
|
||||
|
||||
(eval-and-compile
|
||||
(defconst org-x-prop-routine-choices
|
||||
(org-x-define-prop-choices org-x-prop-routine '("morning" "evening"))
|
||||
"Choices for `org-x-prop-routine'."))
|
||||
(defconst org-x-prop-routine-morning "morning"
|
||||
"Property value for morning routine.")
|
||||
|
||||
(defconst org-x-prop-routine-evening "evening"
|
||||
"Property value for evening routine.")
|
||||
|
||||
(defconst org-x-prop-created "CREATED"
|
||||
"Property denoting when a headline was created.")
|
||||
|
@ -426,22 +424,31 @@ compared to REF-TIME. Returns nil if no timestamp is found."
|
|||
|
||||
;; property testing
|
||||
|
||||
(defun org-x-headline-has-property (property value &optional inherit)
|
||||
"Return t if headline under point has PROPERTY with VALUE.
|
||||
INHERIT is passed to `org-entry-get'."
|
||||
(equal value (org-entry-get nil property inherit)))
|
||||
|
||||
(defun org-x-is-periodical-heading-p ()
|
||||
"Return t if heading is a periodical."
|
||||
(equal "periodical" (org-entry-get nil org-x-prop-parent-type t)))
|
||||
(org-x-headline-has-property org-x-prop-parent-type
|
||||
org-x-prop-parent-type-periodical t))
|
||||
|
||||
(defun org-x-is-iterator-heading-p ()
|
||||
"Return t if heading is an iterator."
|
||||
(equal "iterator" (org-entry-get nil org-x-prop-parent-type t)))
|
||||
(org-x-headline-has-property org-x-prop-parent-type
|
||||
org-x-prop-parent-type-iterator t))
|
||||
|
||||
(defun org-x-is-habit-heading-p ()
|
||||
"Return t if heading is an iterator."
|
||||
(equal "habit" (org-entry-get nil "STYLE" t)))
|
||||
(org-x-headline-has-property "STYLE" "habit"))
|
||||
|
||||
(defun org-x-headline-has-effort-p ()
|
||||
"Return t if heading has an effort."
|
||||
(org-entry-get nil org-effort-property))
|
||||
|
||||
;; tag testing
|
||||
|
||||
(defun org-x-headline-has-context-p ()
|
||||
"Return non-nil if heading has a context tag."
|
||||
(--any
|
||||
|
|
Loading…
Reference in New Issue