split series into iterator and periodical

This commit is contained in:
petrucci4prez 2018-05-04 21:22:55 -04:00
parent 6aaea10491
commit 17476fc0c1
2 changed files with 40 additions and 25 deletions

10
conf.el
View File

@ -318,14 +318,14 @@ to which the faces are applied"
(nd/add-tag-face "PaleGoldenrod" 8 10) (nd/add-tag-face "PaleGoldenrod" 8 10)
(nd/add-tag-face "violet" 11 19) (nd/add-tag-face "violet" 11 19)
(add-to-list 'org-default-properties "PROJECT_TYPE") (add-to-list 'org-default-properties "PARENT_TYPE")
(add-to-list 'org-default-properties "OWNER") (add-to-list 'org-default-properties "OWNER")
(setq org-global-properties (setq org-global-properties
'(("Project_Type_ALL" . "series") '(("PARENT_TYPE_ALL" . "periodical iterator")
("Effort_ALL" . "00 10 30 60 90"))) ("Effort_ALL" . "00 10 30 60 90")))
;; TODO this may not be needed ;; TODO this may not be needed
(setq org-use-property-inheritance '("Project_Type")) (setq org-use-property-inheritance '("PARENT_TYPE"))
(setq org-capture-templates (setq org-capture-templates
'(("t" "todo" entry (file "~/Org/capture.org") "* TODO %?\ndeliverable: \n%U\n") '(("t" "todo" entry (file "~/Org/capture.org") "* TODO %?\ndeliverable: \n%U\n")
@ -769,8 +769,8 @@ test-fun return true"
(org-agenda-sorting-strategy '(category-keep))))) (org-agenda-sorting-strategy '(category-keep)))))
(let ((task-view-match "-NA-REFILE") (let ((task-view-match "-NA-REFILE")
(project-view-match "-NA-REFILE-Project_Type=\"series\"/") (project-view-match "-NA-REFILE-PARENT_TYPE=\"iterator\"/")
(series-view-match "-NA-REFILE+Project_Type=\"series\"/")) (series-view-match "-NA-REFILE+PARENT_TYPE=\"iterator\"/"))
(setq org-agenda-custom-commands (setq org-agenda-custom-commands
`(("t" `(("t"
"Task View" "Task View"

View File

@ -483,14 +483,14 @@ There are several types of tags I use:
#+END_SRC #+END_SRC
** properties ** properties
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(add-to-list 'org-default-properties "PROJECT_TYPE") (add-to-list 'org-default-properties "PARENT_TYPE")
(add-to-list 'org-default-properties "OWNER") (add-to-list 'org-default-properties "OWNER")
(setq org-global-properties (setq org-global-properties
'(("Project_Type_ALL" . "series") '(("PARENT_TYPE_ALL" . "periodical iterator")
("Effort_ALL" . "00 10 30 60 90"))) ("Effort_ALL" . "00 10 30 60 90")))
;; TODO this may not be needed ;; TODO this may not be needed
(setq org-use-property-inheritance '("Project_Type")) (setq org-use-property-inheritance '("PARENT_TYPE"))
#+END_SRC #+END_SRC
** capture templates ** capture templates
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
@ -584,6 +584,8 @@ Each of these returns the timestamp if found.
timestamp))) timestamp)))
#+END_SRC #+END_SRC
**** task level testing **** task level testing
Each of these returns the keyword if true
Doubles as a way to further test the todostate in downstream functions
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(defun nd/is-todoitem-p () (defun nd/is-todoitem-p ()
(let ((keyword (nth 2 (org-heading-components)))) (let ((keyword (nth 2 (org-heading-components))))
@ -598,12 +600,18 @@ Each of these returns the timestamp if found.
(defun nd/is-atomic-task-p () (defun nd/is-atomic-task-p ()
(and (not (nd/heading-has-parent)) (nd/is-task-p))) (and (not (nd/heading-has-parent)) (nd/is-task-p)))
#+END_SRC
**** property testing
Returns t is heading matches a certian set of properties
#+BEGIN_SRC emacs-lisp
(defun nd/is-periodical-heading-p ()
(equal "periodical" (org-entry-get nil "PARENT_TYPE" t)))
(defun nd/is-series-heading-p () (defun nd/is-iterator-heading-p ()
"return t if headline has property Project_Type=series" (equal "iterator" (org-entry-get nil "PARENT_TYPE" t)))
(equal "series" (org-entry-get nil "Project_Type" t)))
#+END_SRC #+END_SRC
**** relational testing **** relational testing
Returns t if heading has certain relationship to other headings
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(defun nd/heading-has-children () (defun nd/heading-has-children ()
"returns t if heading has todoitems in its immediate subtree" "returns t if heading has todoitems in its immediate subtree"
@ -794,7 +802,7 @@ These are the primary means we use to sort through tasks. Note that we could do
tags in the custom commands section but I find this easier to maintain and possibly faster. tags in the custom commands section but I find this easier to maintain and possibly faster.
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
;; helper functions ;; helper functions
(defun nd/skip-item () (defun nd/skip-heading ()
(save-excursion (or (outline-next-heading) (point-max)))) (save-excursion (or (outline-next-heading) (point-max))))
(defun nd/skip-subtree () (defun nd/skip-subtree ()
@ -818,7 +826,7 @@ tags in the custom commands section but I find this easier to maintain and possi
(let ((keyword (,heading-fun))) (let ((keyword (,heading-fun)))
(message keyword) (message keyword)
(if (not (and keyword ,test-fun)) (if (not (and keyword ,test-fun))
(nd/skip-item))))) (nd/skip-heading)))))
;; stale headings ;; stale headings
;; For archiving headings with old timestamps ;; For archiving headings with old timestamps
@ -838,7 +846,7 @@ tags in the custom commands section but I find this easier to maintain and possi
(not (member keyword org-done-keywords)) (not (member keyword org-done-keywords))
(not (nd/heading-has-children)) (not (nd/heading-has-children))
(not (nd/heading-has-parent)))) (not (nd/heading-has-parent))))
(nd/skip-item))))) (nd/skip-heading)))))
;; atomic tasks ;; atomic tasks
;; by definition these have no parents, so ;; by definition these have no parents, so
@ -882,16 +890,16 @@ tags in the custom commands section but I find this easier to maintain and possi
(if (nd/heading-has-children) (if (nd/heading-has-children)
(if (member keyword nd/project-skip-todostates) (if (member keyword nd/project-skip-todostates)
(nd/skip-subtree) (nd/skip-subtree)
(nd/skip-item)) (nd/skip-heading))
(if (not (and (nd/heading-has-parent) (if (not (and (nd/heading-has-parent)
(not (nd/is-timestamped-heading-p)) (not (nd/is-timestamped-heading-p))
(not (nd/is-scheduled-heading-p)) (not (nd/is-scheduled-heading-p))
(not (nd/is-deadlined-heading-p)) (not (nd/is-deadlined-heading-p))
(equal keyword skip-keyword))) (equal keyword skip-keyword)))
(nd/skip-item))) (nd/skip-heading)))
(nd/skip-item))))) (nd/skip-heading)))))
;; task-level errors ;; header-level errors
(defun nd/skip-non-discontinuous-project-tasks () (defun nd/skip-non-discontinuous-project-tasks ()
(nd/skip-heading-with (nd/skip-heading-with
nd/is-todoitem-p nd/is-todoitem-p
@ -909,10 +917,17 @@ tags in the custom commands section but I find this easier to maintain and possi
(and (not (member keyword org-done-keywords)) (and (not (member keyword org-done-keywords))
(nd/is-closed-heading-p)))) (nd/is-closed-heading-p))))
(defun nd/skip-non-series-atomic-tasks () (defun nd/skip-non-untimestamped-periodical-headers ()
(save-restriction
(widen)
(if (not (and (nd/is-periodical-p)
(not (nd/is-timestamped-heading-p))))
(nd/skip-heading))))
(defun nd/skip-non-iterator-atomic-tasks ()
(nd/skip-heading-with (nd/skip-heading-with
nd/is-atomic-task-p nd/is-atomic-task-p
(nd/is-series-heading-p))) (nd/is-iterator-heading-p)))
;; projects ;; projects
(defun nd/skip-projects-without-statuscode (statuscode) (defun nd/skip-projects-without-statuscode (statuscode)
@ -924,8 +939,8 @@ tags in the custom commands section but I find this easier to maintain and possi
(nd/heading-has-parent)) (nd/heading-has-parent))
(nd/skip-subtree) (nd/skip-subtree)
(if (not (nd/is-project-status-p statuscode)) (if (not (nd/is-project-status-p statuscode))
(nd/skip-item))) (nd/skip-heading)))
(nd/skip-item))))) (nd/skip-heading)))))
#+END_SRC #+END_SRC
*** interactive view functions *** interactive view functions
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
@ -969,8 +984,8 @@ tags in the custom commands section but I find this easier to maintain and possi
(org-agenda-sorting-strategy '(category-keep))))) (org-agenda-sorting-strategy '(category-keep)))))
(let ((task-view-match "-NA-REFILE") (let ((task-view-match "-NA-REFILE")
(project-view-match "-NA-REFILE-Project_Type=\"series\"/") (project-view-match "-NA-REFILE-PARENT_TYPE=\"iterator\"/")
(series-view-match "-NA-REFILE+Project_Type=\"series\"/")) (series-view-match "-NA-REFILE+PARENT_TYPE=\"iterator\"/"))
(setq org-agenda-custom-commands (setq org-agenda-custom-commands
`(("t" `(("t"
"Task View" "Task View"
@ -992,7 +1007,7 @@ tags in the custom commands section but I find this easier to maintain and possi
,(nd/agenda-base-project-command series-view-match "Active Series" :active) ,(nd/agenda-base-project-command series-view-match "Active Series" :active)
,(nd/agenda-base-project-command series-view-match "Waiting Series" :waiting) ,(nd/agenda-base-project-command series-view-match "Waiting Series" :waiting)
,(nd/agenda-base-project-command series-view-match "Held Series" :held) ,(nd/agenda-base-project-command series-view-match "Held Series" :held)
,(nd/agenda-base-task-command series-view-match "Uninitialized Series" ''nd/skip-non-series-atomic-tasks))) ,(nd/agenda-base-task-command series-view-match "Uninitialized Series" ''nd/skip-non-iterator-atomic-tasks)))
("r" ("r"
"Refile and Critical Errors" "Refile and Critical Errors"
((tags "REFILE" ((tags "REFILE"