update projects and redefine iterators

This commit is contained in:
petrucci4prez 2018-06-23 20:28:26 -04:00
parent af70878c81
commit 0823feb3ef
2 changed files with 138 additions and 32 deletions

84
conf.el
View File

@ -865,6 +865,34 @@ Note that this assumes the headline being tested is a valid project"
(t (if (not (member statuscode nd/project-statuscodes)) (t (if (not (member statuscode nd/project-statuscodes))
(error "unknown statuscode"))))) (error "unknown statuscode")))))
(defconst nd/iter-future-time (* 7 24 60 60))
(defconst nd/iter-statuscodes '(:uninit :empty :active))
(defun nd/get-iterator-status ()
(let ((iter-status :uninit)
(subtree-end (save-excursion (org-end-of-subtree))))
(save-excursion
(setq previous-point (point))
(outline-next-heading)
(while (and (not (eq iter-status :active))
(< (point) subtree-end))
(let ((keyword (nd/is-atomic-task-p))
(new-status))
(if keyword
(progn
(setq new-status (if (nd/heading-compare-timestamp
(lambda ()
(or (nd/is-scheduled-heading-p)
(nd/is-deadlined-heading-p)))
nd/iter-future-time t)
:active
:empty))
(if (nd/compare-statuscodes0 > new-status iter-status nd/iter-statuscodes)
(setq iter-status new-status)))))
(outline-next-heading)))
iter-status))
(defun nd/skip-heading () (defun nd/skip-heading ()
(save-excursion (or (outline-next-heading) (point-max)))) (save-excursion (or (outline-next-heading) (point-max))))
@ -1245,9 +1273,19 @@ set as a text property for further sorting"
,(nd/agenda-base-task-cmd "-NA-REFILE+%inc/!" ,(nd/agenda-base-task-cmd "-NA-REFILE+%inc/!"
"Incubated Tasks" "Incubated Tasks"
''nd/skip-non-atomic-tasks) ''nd/skip-non-atomic-tasks)
,(nd/agenda-base-proj-cmd "-NA-REFILE+%inc/!" (tags-todo
"Incubated Projects" "-NA-REFILE+%inc/!"
:held))) ((org-agenda-overriding-header
(concat (and
nd/agenda-limit-project-toplevel "Toplevel ")
"Incubated Projects"))
(org-agenda-skip-function '(nd/skip-non-projects))
(org-agenda-before-sorting-filter-function
(lambda (l) (nd/org-agenda-filter-projects '(:stuck :waiting :held :active) l)))
(org-agenda-cmp-user-defined
(lambda (a b) (nd/org-agenda-sort-prop 'project-status '(:stuck :waiting :active :held) a b)))
(org-agenda-prefix-format '((tags . " %-12:c %(format \"xxxx: \")")))
(org-agenda-sorting-strategy '(user-defined-down category-keep))))))
("r" ("r"
"Refile and Critical Errors" "Refile and Critical Errors"
@ -1256,10 +1294,7 @@ set as a text property for further sorting"
(org-tags-match-list-sublevels nil)) (org-tags-match-list-sublevels nil))
,(nd/agenda-base-task-cmd task-match ,(nd/agenda-base-task-cmd task-match
"Discontinous Project" "Discontinous Project"
''nd/skip-non-discontinuous-project-tasks) ''nd/skip-non-discontinuous-project-tasks)))
,(nd/agenda-base-proj-cmd act-no-rep-match
"Invalid Todostate"
:invalid-todostate)))
("e" ("e"
"Non-critical Errors" "Non-critical Errors"
@ -1269,12 +1304,19 @@ set as a text property for further sorting"
,(nd/agenda-base-header-cmd (concat actionable "-" periodical) ,(nd/agenda-base-header-cmd (concat actionable "-" periodical)
"Done Unclosed" "Done Unclosed"
''nd/skip-non-done-unclosed-todoitems) ''nd/skip-non-done-unclosed-todoitems)
,(nd/agenda-base-proj-cmd task-match (tags-todo
"Undone Completed" ,act-no-rep-match
:undone-complete) ((org-agenda-overriding-header
,(nd/agenda-base-proj-cmd (concat actionable "-" periodical) (concat (and
"Done Incompleted" nd/agenda-limit-project-toplevel "Toplevel ")
:done-incomplete))) "Project Errors"))
(org-agenda-skip-function '(nd/skip-non-projects))
(org-agenda-before-sorting-filter-function
(lambda (l) (nd/org-agenda-filter-projects '(:scheduled-project :invalid-todostate :undone-complete :done-incomplete) l)))
(org-agenda-cmp-user-defined
(lambda (a b) (nd/org-agenda-sort-prop 'project-status '(:scheduled-project :invalid-todostate :undone-complete :done-incomplete) a b)))
(org-agenda-prefix-format '((tags . " %-12:c %(format \"xxxx: \")")))
(org-agenda-sorting-strategy '(user-defined-down category-keep))))))
("A" ("A"
"Archivable Tasks and Projects" "Archivable Tasks and Projects"
@ -1287,9 +1329,19 @@ set as a text property for further sorting"
,(nd/agenda-base-proj-cmd (concat actionable "-" periodical "+" iterator) ,(nd/agenda-base-proj-cmd (concat actionable "-" periodical "+" iterator)
"Archivable Iterators" "Archivable Iterators"
:archivable) :archivable)
,(nd/agenda-base-proj-cmd (concat actionable "-" periodical "-" iterator) (tags-todo
"Archivable Projects" ,(concat actionable "-" periodical "-" iterator)
:archivable)))))) ((org-agenda-overriding-header
(concat (and
nd/agenda-limit-project-toplevel "Toplevel ")
"Archivable Projects"))
(org-agenda-skip-function '(nd/skip-non-projects))
(org-agenda-before-sorting-filter-function
(lambda (l) (nd/org-agenda-filter-projects '(:archivable) l)))
(org-agenda-cmp-user-defined
(lambda (a b) (nd/org-agenda-sort-prop 'project-status '(:archivable) a b)))
(org-agenda-prefix-format '((tags . " %-12:c %(format \"xxxx: \")")))
(org-agenda-sorting-strategy '(user-defined-down category-keep)))))))))
(setq org-agenda-start-on-weekday 0) (setq org-agenda-start-on-weekday 0)
(setq org-agenda-span 'day) (setq org-agenda-span 'day)

View File

@ -1094,6 +1094,36 @@ Note that this assumes the headline being tested is a valid project"
(t (if (not (member statuscode nd/project-statuscodes)) (t (if (not (member statuscode nd/project-statuscodes))
(error "unknown statuscode"))))) (error "unknown statuscode")))))
#+END_SRC #+END_SRC
**** iterator testing
#+BEGIN_SRC emacs-lisp
(defconst nd/iter-future-time (* 7 24 60 60))
(defconst nd/iter-statuscodes '(:uninit :empty :active))
(defun nd/get-iterator-status ()
(let ((iter-status :uninit)
(subtree-end (save-excursion (org-end-of-subtree))))
(save-excursion
(setq previous-point (point))
(outline-next-heading)
(while (and (not (eq iter-status :active))
(< (point) subtree-end))
(let ((keyword (nd/is-atomic-task-p))
(new-status))
(if keyword
(progn
(setq new-status (if (nd/heading-compare-timestamp
(lambda ()
(or (nd/is-scheduled-heading-p)
(nd/is-deadlined-heading-p)))
nd/iter-future-time t)
:active
:empty))
(if (nd/compare-statuscodes0 > new-status iter-status nd/iter-statuscodes)
(setq iter-status new-status)))))
(outline-next-heading)))
iter-status))
#+END_SRC
*** skip functions *** skip functions
These are the primary means we use to sort through tasks. Note that we could do this with These are the primary means we use to sort through tasks. Note that we could do this with
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.
@ -1542,9 +1572,19 @@ set as a text property for further sorting"
,(nd/agenda-base-task-cmd "-NA-REFILE+%inc/!" ,(nd/agenda-base-task-cmd "-NA-REFILE+%inc/!"
"Incubated Tasks" "Incubated Tasks"
''nd/skip-non-atomic-tasks) ''nd/skip-non-atomic-tasks)
,(nd/agenda-base-proj-cmd "-NA-REFILE+%inc/!" (tags-todo
"Incubated Projects" "-NA-REFILE+%inc/!"
:held))) ((org-agenda-overriding-header
(concat (and
nd/agenda-limit-project-toplevel "Toplevel ")
"Incubated Projects"))
(org-agenda-skip-function '(nd/skip-non-projects))
(org-agenda-before-sorting-filter-function
(lambda (l) (nd/org-agenda-filter-projects '(:stuck :waiting :held :active) l)))
(org-agenda-cmp-user-defined
(lambda (a b) (nd/org-agenda-sort-prop 'project-status '(:stuck :waiting :active :held) a b)))
(org-agenda-prefix-format '((tags . " %-12:c %(format \"xxxx: \")")))
(org-agenda-sorting-strategy '(user-defined-down category-keep))))))
("r" ("r"
"Refile and Critical Errors" "Refile and Critical Errors"
@ -1553,10 +1593,7 @@ set as a text property for further sorting"
(org-tags-match-list-sublevels nil)) (org-tags-match-list-sublevels nil))
,(nd/agenda-base-task-cmd task-match ,(nd/agenda-base-task-cmd task-match
"Discontinous Project" "Discontinous Project"
''nd/skip-non-discontinuous-project-tasks) ''nd/skip-non-discontinuous-project-tasks)))
,(nd/agenda-base-proj-cmd act-no-rep-match
"Invalid Todostate"
:invalid-todostate)))
("e" ("e"
"Non-critical Errors" "Non-critical Errors"
@ -1566,12 +1603,19 @@ set as a text property for further sorting"
,(nd/agenda-base-header-cmd (concat actionable "-" periodical) ,(nd/agenda-base-header-cmd (concat actionable "-" periodical)
"Done Unclosed" "Done Unclosed"
''nd/skip-non-done-unclosed-todoitems) ''nd/skip-non-done-unclosed-todoitems)
,(nd/agenda-base-proj-cmd task-match (tags-todo
"Undone Completed" ,act-no-rep-match
:undone-complete) ((org-agenda-overriding-header
,(nd/agenda-base-proj-cmd (concat actionable "-" periodical) (concat (and
"Done Incompleted" nd/agenda-limit-project-toplevel "Toplevel ")
:done-incomplete))) "Project Errors"))
(org-agenda-skip-function '(nd/skip-non-projects))
(org-agenda-before-sorting-filter-function
(lambda (l) (nd/org-agenda-filter-projects '(:scheduled-project :invalid-todostate :undone-complete :done-incomplete) l)))
(org-agenda-cmp-user-defined
(lambda (a b) (nd/org-agenda-sort-prop 'project-status '(:scheduled-project :invalid-todostate :undone-complete :done-incomplete) a b)))
(org-agenda-prefix-format '((tags . " %-12:c %(format \"xxxx: \")")))
(org-agenda-sorting-strategy '(user-defined-down category-keep))))))
("A" ("A"
"Archivable Tasks and Projects" "Archivable Tasks and Projects"
@ -1584,9 +1628,19 @@ set as a text property for further sorting"
,(nd/agenda-base-proj-cmd (concat actionable "-" periodical "+" iterator) ,(nd/agenda-base-proj-cmd (concat actionable "-" periodical "+" iterator)
"Archivable Iterators" "Archivable Iterators"
:archivable) :archivable)
,(nd/agenda-base-proj-cmd (concat actionable "-" periodical "-" iterator) (tags-todo
"Archivable Projects" ,(concat actionable "-" periodical "-" iterator)
:archivable)))))) ((org-agenda-overriding-header
(concat (and
nd/agenda-limit-project-toplevel "Toplevel ")
"Archivable Projects"))
(org-agenda-skip-function '(nd/skip-non-projects))
(org-agenda-before-sorting-filter-function
(lambda (l) (nd/org-agenda-filter-projects '(:archivable) l)))
(org-agenda-cmp-user-defined
(lambda (a b) (nd/org-agenda-sort-prop 'project-status '(:archivable) a b)))
(org-agenda-prefix-format '((tags . " %-12:c %(format \"xxxx: \")")))
(org-agenda-sorting-strategy '(user-defined-down category-keep)))))))))
#+END_SRC #+END_SRC
*** views *** views
**** calendar display **** calendar display