From b930cac53a79177937e49b3558de45babb8c2762 Mon Sep 17 00:00:00 2001 From: ndwarshuis Date: Sun, 11 Apr 2021 00:58:18 -0400 Subject: [PATCH] REF move constants to org-x library --- etc/conf.org | 19 ------------------- local/lib/org-x/org-x.el | 30 +++++++++++++++++++++--------- 2 files changed, 21 insertions(+), 28 deletions(-) diff --git a/etc/conf.org b/etc/conf.org index 346ec06..996bfee 100644 --- a/etc/conf.org +++ b/etc/conf.org @@ -2994,25 +2994,6 @@ If I don't include this, I actually forget about major holidays. (setq calendar-holidays (append holiday-general-holidays holiday-christian-holidays)) #+END_SRC -**** block agenda library -These are functions and variables exclusively for agenda block manipulation within the context of =org-custom-agenda-commands=. -***** constants -:PROPERTIES: -:ID: eea59f33-b2c5-462b-9377-4c0dedd90c56 -:END: -#+BEGIN_SRC emacs-lisp -(defconst org-clone-iter-future-time (* 7 24 60 60) - "Iterators must have at least one task greater into the future to be active.") - -;; TODO ;unscheduled should trump all -(defconst org-clone-iter-statuscodes '(:uninit :empt :actv :project-error :unscheduled) - "Iterators can have these statuscodes.") - -(defconst org-clone-peri-future-time org-clone-iter-future-time - "Periodicals must have at least one heading greater into the future to be fresh.") - -(defconst org-clone-peri-statuscodes '(:uninit :empt :actv :unscheduled)) -#+END_SRC **** super agenda :PROPERTIES: :ID: 6bd2a7c9-2104-4b18-9f56-c1581ed86d82 diff --git a/local/lib/org-x/org-x.el b/local/lib/org-x/org-x.el index 1272518..4ef02f6 100644 --- a/local/lib/org-x/org-x.el +++ b/local/lib/org-x/org-x.el @@ -34,6 +34,18 @@ ;; constants +(defconst org-x-iter-future-time (* 7 24 60 60) + "Iterators must have at least one task greater into the future to be active.") + +;; TODO ;unscheduled should trump all +(defconst org-x-iter-statuscodes '(:uninit :empt :actv :project-error :unscheduled) + "Iterators can have these statuscodes.") + +(defconst org-x-peri-future-time org-x-iter-future-time + "Periodicals must have at least one heading greater into the future to be fresh.") + +(defconst org-x-peri-statuscodes '(:uninit :empt :actv :unscheduled)) + (defconst org-x-archive-delay 30 "The number of days to wait before tasks are considered archivable.") @@ -481,7 +493,7 @@ should be this function again)." (let ((ts (org-x-is-scheduled-heading-p))) (cond ((not ts) 0) - ((> org-clone-iter-future-time (- ts (float-time))) 1) + ((> org-x-iter-future-time (- ts (float-time))) 1) (t 2))) org-x--clone-get-iterator-project-status)) @@ -491,8 +503,8 @@ should be this function again)." "Get the status of an iterator. Allowed statuscodes are in list `nd/get-iter-statuscodes.' where latter codes in the list trump earlier ones." - (let ((cur-status (first org-clone-iter-statuscodes)) - (breaker-status (-last-item org-clone-iter-statuscodes)) + (let ((cur-status (first org-x-iter-statuscodes)) + (breaker-status (-last-item org-x-iter-statuscodes)) (subtree-end (save-excursion (org-end-of-subtree t))) (prev-point (point)) (kw nil) @@ -517,9 +529,9 @@ Allowed statuscodes are in list `nd/get-iter-statuscodes.' where (cond ((member kw org-done-keywords) :empt) ((not ts) :unscheduled) - ((< org-clone-iter-future-time (- ts (float-time))) :actv) + ((< org-x-iter-future-time (- ts (float-time))) :actv) (t :empt)))) - (when (org-x-compare-statuscodes > new-status cur-status org-clone-iter-statuscodes) + (when (org-x-compare-statuscodes > new-status cur-status org-x-iter-statuscodes) (setq cur-status new-status))) (setq prev-point (point)) (org-forward-heading-same-level 1 t))) @@ -545,13 +557,13 @@ latter codes in the list trump earlier ones." (cur-status ts) (let ((new (cond ((not ts) :unscheduled) - ((< org-clone-peri-future-time (- ts (float-time))) :actv) + ((< org-x-peri-future-time (- ts (float-time))) :actv) (t :empt)))) - (if (org-x-compare-statuscodes > new cur-status org-clone-peri-statuscodes) + (if (org-x-compare-statuscodes > new cur-status org-x-peri-statuscodes) new cur-status)))) - (let ((cur-status (first org-clone-peri-statuscodes)) - (breaker-status (-last-item org-clone-peri-statuscodes)) + (let ((cur-status (first org-x-peri-statuscodes)) + (breaker-status (-last-item org-x-peri-statuscodes)) (subtree-end (save-excursion (org-end-of-subtree t))) (prev-point (point))) (save-excursion