REF move constants to org-x library

This commit is contained in:
Nathan Dwarshuis 2021-04-11 00:58:18 -04:00
parent 45d82754ca
commit b930cac53a
2 changed files with 21 additions and 28 deletions

View File

@ -2994,25 +2994,6 @@ If I don't include this, I actually forget about major holidays.
(setq calendar-holidays (append holiday-general-holidays (setq calendar-holidays (append holiday-general-holidays
holiday-christian-holidays)) holiday-christian-holidays))
#+END_SRC #+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 **** super agenda
:PROPERTIES: :PROPERTIES:
:ID: 6bd2a7c9-2104-4b18-9f56-c1581ed86d82 :ID: 6bd2a7c9-2104-4b18-9f56-c1581ed86d82

View File

@ -34,6 +34,18 @@
;; constants ;; 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 (defconst org-x-archive-delay 30
"The number of days to wait before tasks are considered archivable.") "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))) (let ((ts (org-x-is-scheduled-heading-p)))
(cond (cond
((not ts) 0) ((not ts) 0)
((> org-clone-iter-future-time (- ts (float-time))) 1) ((> org-x-iter-future-time (- ts (float-time))) 1)
(t 2))) (t 2)))
org-x--clone-get-iterator-project-status)) org-x--clone-get-iterator-project-status))
@ -491,8 +503,8 @@ should be this function again)."
"Get the status of an iterator. "Get the status of an iterator.
Allowed statuscodes are in list `nd/get-iter-statuscodes.' where Allowed statuscodes are in list `nd/get-iter-statuscodes.' where
latter codes in the list trump earlier ones." latter codes in the list trump earlier ones."
(let ((cur-status (first org-clone-iter-statuscodes)) (let ((cur-status (first org-x-iter-statuscodes))
(breaker-status (-last-item org-clone-iter-statuscodes)) (breaker-status (-last-item org-x-iter-statuscodes))
(subtree-end (save-excursion (org-end-of-subtree t))) (subtree-end (save-excursion (org-end-of-subtree t)))
(prev-point (point)) (prev-point (point))
(kw nil) (kw nil)
@ -517,9 +529,9 @@ Allowed statuscodes are in list `nd/get-iter-statuscodes.' where
(cond (cond
((member kw org-done-keywords) :empt) ((member kw org-done-keywords) :empt)
((not ts) :unscheduled) ((not ts) :unscheduled)
((< org-clone-iter-future-time (- ts (float-time))) :actv) ((< org-x-iter-future-time (- ts (float-time))) :actv)
(t :empt)))) (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 cur-status new-status)))
(setq prev-point (point)) (setq prev-point (point))
(org-forward-heading-same-level 1 t))) (org-forward-heading-same-level 1 t)))
@ -545,13 +557,13 @@ latter codes in the list trump earlier ones."
(cur-status ts) (cur-status ts)
(let ((new (cond (let ((new (cond
((not ts) :unscheduled) ((not ts) :unscheduled)
((< org-clone-peri-future-time (- ts (float-time))) :actv) ((< org-x-peri-future-time (- ts (float-time))) :actv)
(t :empt)))) (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 new
cur-status)))) cur-status))))
(let ((cur-status (first org-clone-peri-statuscodes)) (let ((cur-status (first org-x-peri-statuscodes))
(breaker-status (-last-item org-clone-peri-statuscodes)) (breaker-status (-last-item org-x-peri-statuscodes))
(subtree-end (save-excursion (org-end-of-subtree t))) (subtree-end (save-excursion (org-end-of-subtree t)))
(prev-point (point))) (prev-point (point)))
(save-excursion (save-excursion