From db518f80498e856510962021d27e473ee9589eb4 Mon Sep 17 00:00:00 2001 From: ndwarshuis Date: Thu, 12 May 2022 23:38:40 -0400 Subject: [PATCH 01/25] WIP use trees to compute buffer status for weekly plan --- local/lib/org-x/org-x-dag.el | 71 +++++++++++++++++++++++++++++++----- 1 file changed, 62 insertions(+), 9 deletions(-) diff --git a/local/lib/org-x/org-x-dag.el b/local/lib/org-x/org-x-dag.el index 8a5f36a..c97603e 100644 --- a/local/lib/org-x/org-x-dag.el +++ b/local/lib/org-x/org-x-dag.el @@ -1056,6 +1056,8 @@ deadline (eg via epoch time) or if it has a repeater." ;; TODO this is super inefficient, make a plist mapper function (-let* (((node . children) tree) ((&plist :id i :parents ps :node-meta m) node) + ;; TODO don't calculate this unless there are actually children + ;; that need to use it (new-ancestry (funcall ancestry-fun m ancestry)) ((shallow rest) (->> children (--map (funcall child-fun it new-ancestry)) @@ -1226,25 +1228,52 @@ deadline (eg via epoch time) or if it has a repeater." (t (org-x-dag-bs-error-kw "QTP" it-todo))))))) -(defun org-x-dag-bs-wkp-inner (node-data) - (-let* (((&plist :parent-tags (o d m y)) node-data) - (date-abs (->> (org-x-dag-tags-to-date y m d) - (org-x-dag-date-to-absolute))) - (offset (org-x-dag-tag-to-offset o)) - (pair `(:date ,date-abs :offset ,offset))) +(defun org-x-dag-bs-wkp-leaf-inner (node-data ancestry child-bss) + (if (child-bss) (either :left "Weekly plan nodes cannot have children") (org-x-dag-bs-with-closed node-data "weekly plan" - `(:complete (,@it-comptime ,@pair)) - (either :right `(:complete (,@it-comptime ,@pair))) + `(:complete ,it-comptime) + (either :right `(:complete ,it-comptime)) (cond ((-some->> it-planning (org-ml-get-properties :scheduled)) (either :left "WKPs cannot be scheduled")) ((-some->> it-planning (org-ml-get-properties :deadline)) (either :left "WKPs cannot be deadlined")) ((equal it-todo org-x-kw-todo) - (either :right `(:active ,pair))) + (either :right `(:active))) (t (org-x-dag-bs-error-kw "WKP" it-todo)))))) +(defun org-x-dag-bs-wkp-branch-inner (node-data ancestry child-bss) + (org-x-dag-bs-with-closed node-data "weekly plan" + `(:complete ,it-comptime) + (either :right `(:complete ,it-comptime)) + (let ((sched (-some->> it-planning (org-ml-get-properties :scheduled)))) + (cond + ((or (not sched) (org-ml-time-is-long sched)) + (either :left "WKP day nodes must be short scheduled")) + ((-some->> it-planning (org-ml-get-properties :deadline)) + (either :left "WKP day nodes cannot be deadlined")) + ((equal it-todo org-x-kw-todo) + (either :right `(:active))) + (t + (org-x-dag-bs-error-kw "WKP day node" it-todo)))))) + +(defun org-x-dag-bs-wkp-root-inner (node-data ancestry child-bss) + (org-x-dag-bs-with-closed node-data "weekly plan" + `(:complete ,it-comptime) + ;; TODO need to check the week length and the scheduled children + (either :right `(:complete ,it-comptime)) + (let ((sched (-some->> it-planning (org-ml-get-properties :scheduled)))) + (cond + ((or (not sched) (org-ml-time-is-long sched)) + (either :left "WKP root nodes must be short scheduled")) + ((-some->> it-planning (org-ml-get-properties :deadline)) + (either :left "WKP root nodes cannot be deadlined")) + ((equal it-todo org-x-kw-todo) + (either :right `(:active))) + (t + (org-x-dag-bs-error-kw "WKP day node" it-todo)))))) + (defun org-x-dag-bs-dlp-inner (node-data) (org-x-dag-bs-with-closed node-data "daily metablock" `(:complete ,it-comptime) @@ -1276,6 +1305,30 @@ deadline (eg via epoch time) or if it has a repeater." (-let (((n ns) (org-x-dag-bs-with-treetop tree #'org-x-dag-bs-qtp-inner))) (org-x-dag-bs-prefix :quarterly `(,n ,@ns)))) +(defun org-x-dag-bs-wkp-leaf (tree ancestry) + (org-x-dag-bs-with-children-1 + tree + ancestry + (lambda (_ _) nil) + #'org-x-dag-bs-wkp-leaf + #'org-x-dag-bs-wkp-leaf-inner)) + +(defun org-x-dag-bs-wkp-branch (tree ancestry) + (org-x-dag-bs-with-children-1 + tree + ancestry + (lambda (_ _) nil) + #'org-x-dag-bs-wkp-leaf + #'org-x-dag-bs-wkp-branch-inner)) + +(defun org-x-dag-bs-wkp-root (tree ancestry) + (org-x-dag-bs-with-children-1 + tree + ancestry + (lambda (_ _) nil) + #'org-x-dag-bs-wkp-branch + #'org-x-dag-bs-wkp-root-inner)) + (defun org-x-dag-bs-wkp (tree) (-let (((n ns) (org-x-dag-bs-with-treetop tree #'org-x-dag-bs-wkp-inner))) (org-x-dag-bs-prefix :weekly `(,n ,@ns)))) From ffc3875c1024248f2bc57b8f7f2c1cddc7b5cc3f Mon Sep 17 00:00:00 2001 From: ndwarshuis Date: Sat, 14 May 2022 00:06:58 -0400 Subject: [PATCH 02/25] WIP convert weekly buffer status to tree-based representation --- local/lib/org-x/org-x-const.el | 4 ++ local/lib/org-x/org-x-dag.el | 70 +++++++++++++++++++++------------- 2 files changed, 47 insertions(+), 27 deletions(-) diff --git a/local/lib/org-x/org-x-const.el b/local/lib/org-x/org-x-const.el index a3b7bef..d1b6a86 100644 --- a/local/lib/org-x/org-x-const.el +++ b/local/lib/org-x/org-x-const.el @@ -196,6 +196,10 @@ org tag and a long name respectively for the category.") ;; all follow the nomenclature `org-x-prop-PROPNAME' (key) or ;; `org-x-prop-PROPNAME-VALNAME' (value) +(defconst org-x-prop-week-len "X-WEEK-LEN" + "The length of a week in the weekly plan. +Should be an integer greater than 1.") + (defconst org-x-prop-parent-type "PARENT_TYPE" "Property denoting iterator/periodical headline.") diff --git a/local/lib/org-x/org-x-dag.el b/local/lib/org-x/org-x-dag.el index c97603e..582ac0c 100644 --- a/local/lib/org-x/org-x-dag.el +++ b/local/lib/org-x/org-x-dag.el @@ -222,6 +222,7 @@ Must be an integer from 0 - 6, with 0 = Sunday.") DATE-OFFSETS is a list of lists like (ABS OFFSET) where ABS is an absolute date and OFFSET is a positive integer representing a relative shift in days from ABS." + (print date-offsets) (cl-flet ((to-interval (acc date-offset) @@ -1210,11 +1211,11 @@ deadline (eg via epoch time) or if it has a repeater." `(:complete (,@it-comptime :date ,date-abs)) (either :right `(:complete (,@it-comptime :date ,date-abs))) (cond - ((-some->> it-planning (org-ml-get-properties :scheduled)) + ((-some->> it-planning (org-ml-get-property :scheduled)) (either :left "QTPs cannot be scheduled")) ((equal it-todo org-x-kw-todo) (-if-let (dead (-some->> it-planning - (org-ml-get-properties :deadline))) + (org-ml-get-property :deadline))) ;; ASSUME :parent-tags will contain the date tags as the level of ;; the plan will never exceed one (let ((dead-dt (->> (org-ml-timestamp-get-start-time dead) @@ -1229,48 +1230,58 @@ deadline (eg via epoch time) or if it has a repeater." (org-x-dag-bs-error-kw "QTP" it-todo))))))) (defun org-x-dag-bs-wkp-leaf-inner (node-data ancestry child-bss) - (if (child-bss) (either :left "Weekly plan nodes cannot have children") + (if child-bss (either :left "Weekly plan nodes cannot have children") (org-x-dag-bs-with-closed node-data "weekly plan" - `(:complete ,it-comptime) - (either :right `(:complete ,it-comptime)) + `(:leaf :complete ,it-comptime) + (either :right `(:leaf :complete ,it-comptime)) (cond - ((-some->> it-planning (org-ml-get-properties :scheduled)) + ((-some->> it-planning (org-ml-get-property :scheduled)) (either :left "WKPs cannot be scheduled")) - ((-some->> it-planning (org-ml-get-properties :deadline)) + ((-some->> it-planning (org-ml-get-property :deadline)) (either :left "WKPs cannot be deadlined")) ((equal it-todo org-x-kw-todo) - (either :right `(:active))) + (either :right `(:leaf :active))) (t (org-x-dag-bs-error-kw "WKP" it-todo)))))) (defun org-x-dag-bs-wkp-branch-inner (node-data ancestry child-bss) (org-x-dag-bs-with-closed node-data "weekly plan" - `(:complete ,it-comptime) - (either :right `(:complete ,it-comptime)) - (let ((sched (-some->> it-planning (org-ml-get-properties :scheduled)))) + `(:branch :complete ,it-comptime) + (either :right `(:branch :complete ,it-comptime)) + (let ((sched (-some->> it-planning (org-ml-get-property :scheduled)))) (cond ((or (not sched) (org-ml-time-is-long sched)) (either :left "WKP day nodes must be short scheduled")) - ((-some->> it-planning (org-ml-get-properties :deadline)) + ((-some->> it-planning (org-ml-get-property :deadline)) (either :left "WKP day nodes cannot be deadlined")) ((equal it-todo org-x-kw-todo) - (either :right `(:active))) + (either :right `(:branch :active))) (t (org-x-dag-bs-error-kw "WKP day node" it-todo)))))) (defun org-x-dag-bs-wkp-root-inner (node-data ancestry child-bss) (org-x-dag-bs-with-closed node-data "weekly plan" - `(:complete ,it-comptime) + `(:root :complete ,it-comptime) ;; TODO need to check the week length and the scheduled children - (either :right `(:complete ,it-comptime)) - (let ((sched (-some->> it-planning (org-ml-get-properties :scheduled)))) + (either :right `(:root :complete ,it-comptime)) + (let ((sched (-some->> it-planning (org-ml-get-property :scheduled))) + ;; ASSUME anything that isn't actually a number will be converted to + ;; a zero and will fail the test below + (offset (->> (alist-get org-x-prop-week-len + (plist-get node-data :props) + nil nil #'equal) + (string-to-number)))) (cond ((or (not sched) (org-ml-time-is-long sched)) (either :left "WKP root nodes must be short scheduled")) - ((-some->> it-planning (org-ml-get-properties :deadline)) + ((-some->> it-planning (org-ml-get-property :deadline)) (either :left "WKP root nodes cannot be deadlined")) + ((< offset 1) + (either :left "WKP root week length must be an int >= 1")) ((equal it-todo org-x-kw-todo) - (either :right `(:active))) + (let ((date (->> (org-ml-timestamp-get-start-time sched) + (org-x-dag-date-to-absolute)))) + (either :right `(:root :active (:date ,date :offset ,offset))))) (t (org-x-dag-bs-error-kw "WKP day node" it-todo)))))) @@ -1330,7 +1341,7 @@ deadline (eg via epoch time) or if it has a repeater." #'org-x-dag-bs-wkp-root-inner)) (defun org-x-dag-bs-wkp (tree) - (-let (((n ns) (org-x-dag-bs-with-treetop tree #'org-x-dag-bs-wkp-inner))) + (-let (((n ns) (org-x-dag-bs-wkp-root tree nil))) (org-x-dag-bs-prefix :weekly `(,n ,@ns)))) (defun org-x-dag-bs-dlp (tree) @@ -2001,7 +2012,8 @@ removed from, added to, or edited within the DAG respectively." (:action (list org-x-prop-parent-type org-x-prop-time-shift org-x-prop-routine - "ARCHIVE"))) + "ARCHIVE")) + (:weekly (list org-x-prop-week-len))) (append def-props))) (bs-fun (pcase group (:action #'org-x-dag-bs-action) @@ -2060,19 +2072,23 @@ removed from, added to, or edited within the DAG respectively." (defun org-x-dag-weekly-span (date) (cl-flet - ((bs2date-offset - (bs) - (-let (((_ _ (&plist :date d :offset o)) bs)) - `(,d ,o)))) + ((id-date-offset + (adjlist id) + (either-from (org-x-dag-adjlist-id-bs adjlist id) + (-const nil) + (lambda (r) + (pcase r + (`(:weekly :root :active ,p) + (-let (((&plist :date d :offset o) p)) + `(,d ,o)))))))) (-let* (((&plist :dag d :file->ids f) org-x-dag) (adjlist (dag-get-adjacency-list d)) (weekly-file (-> (plist-get org-x-dag-files :plan-files) (plist-get :weekly))) (abs (org-x-dag-date-to-absolute date)) (ints (->> (ht-get f weekly-file) - (--map (org-x-dag-adjlist-id-bs adjlist it)) - (either-rights) - (-map #'bs2date-offset) + (--map (id-date-offset adjlist it)) + (-non-nil) (org-x-dag-weekly-intervals) (interval-sort)))) (-when-let (overlaps (nth 0 (interval-overlaps ints))) From 1e917c0ceeeb3f18bf956d501c47455ea565dbe6 Mon Sep 17 00:00:00 2001 From: ndwarshuis Date: Mon, 16 May 2022 01:01:05 -0400 Subject: [PATCH 03/25] WIP pass the weekly date down the tree --- local/lib/either/either.el | 4 ++ local/lib/org-x/org-x-dag.el | 94 +++++++++++++++++++++++------------- 2 files changed, 64 insertions(+), 34 deletions(-) diff --git a/local/lib/either/either.el b/local/lib/either/either.el index 7ba6e2d..c3fa150 100644 --- a/local/lib/either/either.el +++ b/local/lib/either/either.el @@ -151,5 +151,9 @@ left/right slots." (!cons (cadr it) acc-left))) `(,(nreverse acc-left) ,(nreverse acc-right)))) +(defun either-maybe (fun either) + "Return nil if EITHER is left and apply FUN otherwise." + (either-from either (-const nil) fun)) + (provide 'either) ;;; either.el ends here diff --git a/local/lib/org-x/org-x-dag.el b/local/lib/org-x/org-x-dag.el index 582ac0c..b4a5ef8 100644 --- a/local/lib/org-x/org-x-dag.el +++ b/local/lib/org-x/org-x-dag.el @@ -1260,28 +1260,16 @@ deadline (eg via epoch time) or if it has a repeater." (org-x-dag-bs-error-kw "WKP day node" it-todo)))))) (defun org-x-dag-bs-wkp-root-inner (node-data ancestry child-bss) - (org-x-dag-bs-with-closed node-data "weekly plan" - `(:root :complete ,it-comptime) - ;; TODO need to check the week length and the scheduled children - (either :right `(:root :complete ,it-comptime)) - (let ((sched (-some->> it-planning (org-ml-get-property :scheduled))) - ;; ASSUME anything that isn't actually a number will be converted to - ;; a zero and will fail the test below - (offset (->> (alist-get org-x-prop-week-len - (plist-get node-data :props) - nil nil #'equal) - (string-to-number)))) + (either<$> ancestry + (org-x-dag-bs-with-closed node-data "weekly plan" + `(:root :complete ,it-comptime) + ;; TODO need to check the week length and the scheduled children + (either :right `(:root :complete ,it-comptime)) (cond - ((or (not sched) (org-ml-time-is-long sched)) - (either :left "WKP root nodes must be short scheduled")) ((-some->> it-planning (org-ml-get-property :deadline)) (either :left "WKP root nodes cannot be deadlined")) - ((< offset 1) - (either :left "WKP root week length must be an int >= 1")) ((equal it-todo org-x-kw-todo) - (let ((date (->> (org-ml-timestamp-get-start-time sched) - (org-x-dag-date-to-absolute)))) - (either :right `(:root :active (:date ,date :offset ,offset))))) + (either :right `(:root :active ,it))) (t (org-x-dag-bs-error-kw "WKP day node" it-todo)))))) @@ -1332,16 +1320,42 @@ deadline (eg via epoch time) or if it has a repeater." #'org-x-dag-bs-wkp-leaf #'org-x-dag-bs-wkp-branch-inner)) -(defun org-x-dag-bs-wkp-root (tree ancestry) - (org-x-dag-bs-with-children-1 - tree - ancestry - (lambda (_ _) nil) - #'org-x-dag-bs-wkp-branch - #'org-x-dag-bs-wkp-root-inner)) +(defun org-x-dag-bs-wkp-root (tree) + (-let* (((&plist :node-meta m) (car tree)) + (datetime (->> (plist-get m :planning) + (org-ml-get-property :scheduled) + (org-ml-timestamp-get-start-time))) + (props (plist-get m :props)) + ;; ASSUME anything that isn't actually a number will be converted to + ;; a zero and will fail the test below + (offset (->> (alist-get org-x-prop-week-len props nil nil #'equal) + (string-to-number))) + (ancestry (cond + ((or (not datetime) (org-ml-time-is-long datetime)) + (either :left "WKP root nodes must be short scheduled")) + ((< offset 1) + (either :left "WKP root week length must be an int >= 1")) + (t + (let ((date (org-x-dag-date-to-absolute datetime))) + (either :right `(:date ,date :offset ,offset))))))) + (org-x-dag-bs-with-children-1 + tree + ancestry + (lambda (node-meta ancestry) + (either>>= ancestry + (-if-let (sched (-some->> (plist-get node-meta :planning) + (org-ml-get-property :scheduled) + (org-ml-timestamp-get-start-time))) + (if (org-ml-time-is-long sched) + (either :left "WKP branch node must be short scheduled") + ;; TODO test if this is in bounds + (either :right (org-x-dag-date-to-absolute sched))) + (either :left "WKP branch node must be scheduled")))) + #'org-x-dag-bs-wkp-branch + #'org-x-dag-bs-wkp-root-inner))) (defun org-x-dag-bs-wkp (tree) - (-let (((n ns) (org-x-dag-bs-wkp-root tree nil))) + (-let (((n ns) (org-x-dag-bs-wkp-root tree))) (org-x-dag-bs-prefix :weekly `(,n ,@ns)))) (defun org-x-dag-bs-dlp (tree) @@ -1443,6 +1457,7 @@ deadline (eg via epoch time) or if it has a repeater." (either-from (org-x-dag-adjlist-id-bs adjlist id) (-const nil) (lambda (r) + (print r) (-let (((_ _ (&plist :date d :offset o)) r)) (+ d o))))) @@ -1591,13 +1606,23 @@ denoted by CUR-KEY with any errors that are found." (org-x-dag-ht-add-links id ht-l :planned l)))))) (defun org-x-dag-ns-wkp (adjlist links ns) - (-let (((&alist :quarterly ht-q) ns)) - (org-x-dag-ns-with-valid ns adjlist :weekly links - `((:quarterly ,(-partial #'org-x-dag-ns-is-leaf-p adjlist))) - (lambda (id this-h res) - (-let (((&alist :quarterly q) res)) - (ht-set this-h id (either :right `(:committed ,q))) - (org-x-dag-ht-add-links id ht-q :planned q)))))) + (cl-flet + ((is-valid-leaf-p + (id) + (-when-let (bs (-> (org-x-dag-adjlist-id-bs adjlist id) + (either-from-right nil))) + (eq (nth bs 1) :leaf)))) + (-let (((&alist :quarterly ht-q) ns)) + (org-x-dag-ns-with-valid ns adjlist :weekly links + `((:quarterly ,(-partial #'org-x-dag-ns-is-leaf-p adjlist))) + (lambda (id this-h res) + (-let (((&alist :quarterly q) res)) + (->> (if (is-valid-leaf-p id) + (either :right `(:committed ,q)) + (-> "WKP links can only originate from leaves" + (org-x-dag--ns-err))) + (ht-set this-h id)) + (org-x-dag-ht-add-links id ht-q :planned q))))))) (defun org-x-dag-ns-action (adjlist links ns) (cl-flet @@ -1848,6 +1873,7 @@ DEF-FUN and the output from GET-FUN (type :: a -> NS)." (propagate h it ))))) (defun org-x-dag-get-network-status (sel-date spans adjlist links) + (print spans) (cl-flet ((d-cur-p (link) @@ -1895,7 +1921,7 @@ DEF-FUN and the output from GET-FUN (type :: a -> NS)." (q-cur-p (-partial #'cur-p #'org-x-dag-adjlist-id-qtp-abs qspan)) (w-cur-p (-partial #'cur-p #'org-x-dag-adjlist-id-wkp-abs wspan)) (cur-q (-filter q-cur-p q)) - (cur-w (-filter w-cur-p w)) + (cur-w (when wspan (-filter w-cur-p w))) (cur-d (-filter #'d-cur-p d))) ;; add all links to the network status object (ew side effects) (org-x-dag-ns-ltg adjlist l ns) From c8a27cba5c564b7e74156d463859c91eff7ee5f9 Mon Sep 17 00:00:00 2001 From: ndwarshuis Date: Tue, 17 May 2022 23:44:23 -0400 Subject: [PATCH 04/25] ENH make network status understand weekly tree plans --- local/lib/org-x/org-x-dag.el | 95 ++++++++++++++++++++---------------- 1 file changed, 52 insertions(+), 43 deletions(-) diff --git a/local/lib/org-x/org-x-dag.el b/local/lib/org-x/org-x-dag.el index b4a5ef8..b13dff1 100644 --- a/local/lib/org-x/org-x-dag.el +++ b/local/lib/org-x/org-x-dag.el @@ -222,7 +222,6 @@ Must be an integer from 0 - 6, with 0 = Sunday.") DATE-OFFSETS is a list of lists like (ABS OFFSET) where ABS is an absolute date and OFFSET is a positive integer representing a relative shift in days from ABS." - (print date-offsets) (cl-flet ((to-interval (acc date-offset) @@ -1230,37 +1229,36 @@ deadline (eg via epoch time) or if it has a repeater." (org-x-dag-bs-error-kw "QTP" it-todo))))))) (defun org-x-dag-bs-wkp-leaf-inner (node-data ancestry child-bss) - (if child-bss (either :left "Weekly plan nodes cannot have children") - (org-x-dag-bs-with-closed node-data "weekly plan" - `(:leaf :complete ,it-comptime) - (either :right `(:leaf :complete ,it-comptime)) - (cond - ((-some->> it-planning (org-ml-get-property :scheduled)) - (either :left "WKPs cannot be scheduled")) - ((-some->> it-planning (org-ml-get-property :deadline)) - (either :left "WKPs cannot be deadlined")) - ((equal it-todo org-x-kw-todo) - (either :right `(:leaf :active))) - (t - (org-x-dag-bs-error-kw "WKP" it-todo)))))) + (either>>= ancestry + (if child-bss (either :left "Weekly plan nodes cannot have children") + (org-x-dag-bs-with-closed node-data "weekly plan" + `(:leaf :complete ,it-comptime) + (either :right `(:leaf :complete ,it-comptime)) + (cond + ((-some->> it-planning (org-ml-get-property :scheduled)) + (either :left "WKPs cannot be scheduled")) + ((-some->> it-planning (org-ml-get-property :deadline)) + (either :left "WKPs cannot be deadlined")) + ((equal it-todo org-x-kw-todo) + (either :right `(:leaf :active ,it))) + (t + (org-x-dag-bs-error-kw "WKP" it-todo))))))) (defun org-x-dag-bs-wkp-branch-inner (node-data ancestry child-bss) - (org-x-dag-bs-with-closed node-data "weekly plan" - `(:branch :complete ,it-comptime) - (either :right `(:branch :complete ,it-comptime)) - (let ((sched (-some->> it-planning (org-ml-get-property :scheduled)))) + (either>>= ancestry + (org-x-dag-bs-with-closed node-data "weekly plan" + `(:branch :complete ,it-comptime) + (either :right `(:branch :complete ,it-comptime)) (cond - ((or (not sched) (org-ml-time-is-long sched)) - (either :left "WKP day nodes must be short scheduled")) ((-some->> it-planning (org-ml-get-property :deadline)) (either :left "WKP day nodes cannot be deadlined")) ((equal it-todo org-x-kw-todo) - (either :right `(:branch :active))) + (either :right `(:branch :active ,it))) (t (org-x-dag-bs-error-kw "WKP day node" it-todo)))))) (defun org-x-dag-bs-wkp-root-inner (node-data ancestry child-bss) - (either<$> ancestry + (either>>= ancestry (org-x-dag-bs-with-closed node-data "weekly plan" `(:root :complete ,it-comptime) ;; TODO need to check the week length and the scheduled children @@ -1313,13 +1311,34 @@ deadline (eg via epoch time) or if it has a repeater." #'org-x-dag-bs-wkp-leaf-inner)) (defun org-x-dag-bs-wkp-branch (tree ancestry) - (org-x-dag-bs-with-children-1 - tree - ancestry - (lambda (_ _) nil) - #'org-x-dag-bs-wkp-leaf - #'org-x-dag-bs-wkp-branch-inner)) + (-let ((ancestry + (either-from ancestry + (-const (either :left "Parent error")) + (lambda (date-offset) + (-let (((&plist :node-meta m) (car tree))) + (-if-let (sched (-some->> (plist-get m :planning) + (org-ml-get-property :scheduled) + (org-ml-timestamp-get-start-time))) + (if (org-ml-time-is-long sched) + (either :left "WKP branch node must be short scheduled") + (-let (((&plist :date d :offset o) date-offset) + (this-abs (org-x-dag-date-to-absolute sched))) + (if (and (<= d this-abs) (< this-abs (+ d o))) + (either :right this-abs) + (either :left "WKP branch node must be scheduled")))) + (either :left "WKP branch node must be scheduled"))))))) + (org-x-dag-bs-with-children-1 + tree + ancestry + (lambda (_ ancestry) + (if (either-is-left-p ancestry) + (either :left "Parent error") + ancestry)) + #'org-x-dag-bs-wkp-leaf + #'org-x-dag-bs-wkp-branch-inner))) +;; TODO there are likely at least 10 patterns here that can be abstracted +;; out to make this cleaner (defun org-x-dag-bs-wkp-root (tree) (-let* (((&plist :node-meta m) (car tree)) (datetime (->> (plist-get m :planning) @@ -1341,16 +1360,7 @@ deadline (eg via epoch time) or if it has a repeater." (org-x-dag-bs-with-children-1 tree ancestry - (lambda (node-meta ancestry) - (either>>= ancestry - (-if-let (sched (-some->> (plist-get node-meta :planning) - (org-ml-get-property :scheduled) - (org-ml-timestamp-get-start-time))) - (if (org-ml-time-is-long sched) - (either :left "WKP branch node must be short scheduled") - ;; TODO test if this is in bounds - (either :right (org-x-dag-date-to-absolute sched))) - (either :left "WKP branch node must be scheduled")))) + (lambda (_ ancestry) ancestry) #'org-x-dag-bs-wkp-branch #'org-x-dag-bs-wkp-root-inner))) @@ -1457,9 +1467,8 @@ deadline (eg via epoch time) or if it has a repeater." (either-from (org-x-dag-adjlist-id-bs adjlist id) (-const nil) (lambda (r) - (print r) - (-let (((_ _ (&plist :date d :offset o)) r)) - (+ d o))))) + (pcase r + (`(:weekly ,(or :root :branch :leaf) :active ,d) d))))) (defun org-x-dag-get-children (adjlist id) (->> (plist-get (ht-get adjlist id) :children) @@ -1605,13 +1614,14 @@ denoted by CUR-KEY with any errors that are found." (org-x-dag-ht-add-links id ht-e :planned e) (org-x-dag-ht-add-links id ht-l :planned l)))))) +;; TODO need to somehow puke when anything but a leaf node has a link on it (defun org-x-dag-ns-wkp (adjlist links ns) (cl-flet ((is-valid-leaf-p (id) (-when-let (bs (-> (org-x-dag-adjlist-id-bs adjlist id) (either-from-right nil))) - (eq (nth bs 1) :leaf)))) + (eq (nth 1 bs) :leaf)))) (-let (((&alist :quarterly ht-q) ns)) (org-x-dag-ns-with-valid ns adjlist :weekly links `((:quarterly ,(-partial #'org-x-dag-ns-is-leaf-p adjlist))) @@ -1873,7 +1883,6 @@ DEF-FUN and the output from GET-FUN (type :: a -> NS)." (propagate h it ))))) (defun org-x-dag-get-network-status (sel-date spans adjlist links) - (print spans) (cl-flet ((d-cur-p (link) From 8b1e318c1d4f4789c6062f8e2fdd827f7001cd51 Mon Sep 17 00:00:00 2001 From: ndwarshuis Date: Wed, 18 May 2022 18:58:41 -0400 Subject: [PATCH 05/25] ENH update weekly plan to use tree-based buffer status --- local/lib/org-x/org-x-dag.el | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/local/lib/org-x/org-x-dag.el b/local/lib/org-x/org-x-dag.el index b13dff1..af360ee 100644 --- a/local/lib/org-x/org-x-dag.el +++ b/local/lib/org-x/org-x-dag.el @@ -3126,11 +3126,9 @@ FUTURE-LIMIT in a list." (let ((span (org-x-dag->weekly-span))) (org-x-dag-with-ids files (pcase (either-from-right (org-x-dag-id->bs it) nil) - (`(:weekly :active ,p) - (-let* (((&plist :date d :offset o) p) - (abs (+ d o)) - (day (->> (calendar-gregorian-from-absolute abs) - (calendar-day-of-week)))) + (`(:weekly :leaf :active ,abs) + (let ((day (->> (calendar-gregorian-from-absolute abs) + (calendar-day-of-week)))) (when (interval-contains-p abs span) (let ((ns (-some-> (org-x-dag-id->ns it) (either-from (-const nil) #'identity))) From 3778f8bd7d99fbd5d13b9f968b20b3f37294b27f Mon Sep 17 00:00:00 2001 From: ndwarshuis Date: Wed, 18 May 2022 19:57:47 -0400 Subject: [PATCH 06/25] ENH update buffer functions to use weekly tree structure --- local/lib/org-x/org-x-dag.el | 109 ++++++++++++++++++++++++----------- 1 file changed, 74 insertions(+), 35 deletions(-) diff --git a/local/lib/org-x/org-x-dag.el b/local/lib/org-x/org-x-dag.el index af360ee..55d2dd5 100644 --- a/local/lib/org-x/org-x-dag.el +++ b/local/lib/org-x/org-x-dag.el @@ -3492,6 +3492,19 @@ FUTURE-LIMIT in a list." (-> (org-x-dag-format-month-tag month) (org-x-dag-headlines-find-tag headlines))) +(defun org-x-dag-headlines-find-date (date headlines) + (cl-flet + ((has-date-p + (date headline) + (-when-let (sched (-some->> (org-ml-headline-get-planning headline) + (org-ml-get-property :scheduled) + (org-ml-timestamp-get-start-time) + (org-x-dag-datetime-split) + (car) + (org-x-dag-date-to-absolute))) + (= sched date)))) + (--find (has-date-p date it) headlines))) + (defun org-x-dag-headlines-find-day (day headlines) (-> (org-x-dag-format-day-tag day) (org-x-dag-headlines-find-tag headlines))) @@ -3532,16 +3545,36 @@ FUTURE-LIMIT in a list." (tag (org-x-dag-format-month-tag month))) (org-x-dag-build-planning-headline title tag 2 nil subheadlines))) +(defun org-x-dag-build-week-headline (y m d level subheadlines) + (let ((title (format "%d-%02d-%02d" y m d))) + (->> (apply #'org-ml-build-headline! + :title-text title + :level level + :todo-keyword org-x-kw-todo + :planning `(:scheduled (,y ,m ,d)) + subheadlines) + (org-ml-headline-set-node-property org-x-prop-week-len "7") + (org-x-dag-headline-add-id)))) + +(defun org-x-dag-build-day-of-week-headline (level date subheadlines) + (-let* (((y m d) date) + (daynum (->> (org-x-dag-date-to-gregorian date) + (calendar-day-of-week))) + (title (elt calendar-day-name-array daynum))) + (->> (apply #'org-ml-build-headline! + :title-text title + :level level + :todo-keyword org-x-kw-todo + :planning `(:scheduled (,y ,m ,d)) + subheadlines) + (org-x-dag-headline-add-id)))) + (defun org-x-dag-build-day-headline (date subheadlines) (-let* (((y m d) date) (title (format "%d-%02d-%02d" y m d)) (tag (org-x-dag-format-day-tag d))) (org-x-dag-build-planning-headline title tag 3 nil subheadlines))) -(defun org-x-dag-build-day-of-week-headline (daynum offset subheadlines) - (let ((title (elt calendar-day-name-array daynum)) - (tag (org-x-dag-format-offset-tag offset))) - (org-x-dag-build-planning-headline title tag 3 nil subheadlines))) ;; headline ids @@ -3584,11 +3617,15 @@ FUTURE-LIMIT in a list." :title-text (plist-get it :desc) :tags `(,(plist-get it :tag)))))) -(defun org-x-dag-wkp-empty () - (->> (-iterate #'1+ 0 7) - (--annotate (mod (+ org-x-dag-weekday-start it) 7)) - (--map (org-x-dag-build-day-of-week-headline (car it) (cdr it) nil)))) - +(defun org-x-dag-wkp-empty (date) + (let ((abs (-if-let (span (org-x-dag-weekly-span date)) + (car span) + (->> (org-x-dag-date-to-week-start date) + (org-x-dag-date-to-absolute))))) + (->> (-iterate #'1+ 0 7) + (--map (org-x-dag-absolute-to-date (+ abs it))) + (--map (org-x-dag-build-day-of-week-headline 4 it nil))))) + ;;; stateful buffer function ;; nested headline manipulation @@ -3772,43 +3809,45 @@ FUTURE-LIMIT in a list." ;; (org-x-dag-build-day-of-week-headline daynum hls)) ;; plan)) -(defun org-x-dag-wkp-get-headline-inner (y m d) +(defun org-x-dag-wkp-get-headline-inner (date-abs) (org-x-with-file (org-x-dag->planning-file :weekly) - (->> (org-ml-parse-subtrees 'all) - (org-x-dag-headlines-find-year y) - (org-ml-headline-get-subheadlines) - (org-x-dag-headlines-find-month m) - (org-ml-headline-get-subheadlines) - (org-x-dag-headlines-find-day d)))) + (-let (((m d y) (calendar-gregorian-from-absolute date-abs))) + (->> (org-ml-parse-subtrees 'all) + (org-x-dag-headlines-find-year y) + (org-ml-headline-get-subheadlines) + (org-x-dag-headlines-find-month m) + (org-ml-headline-get-subheadlines) + (org-x-dag-headlines-find-date date-abs))))) (defun org-x-dag-wkp-get-week-headline (date) - (-let (((y m d) (->> (org-x-dag-weekly-span date) - (car) - (org-x-dag-absolute-to-date)))) - (org-x-dag-wkp-get-headline-inner y m d))) + (-when-let (abs (car (org-x-dag-weekly-span date))) + (org-x-dag-wkp-get-headline-inner abs))) (defun org-x-dag-wkp-get-day-headline (date) - (-let ((abs (car (org-x-dag-weekly-span date))) - ((y m d) (org-x-dag-absolute-to-date abs)) - (offset (- (org-x-dag-date-to-absolute date) abs))) - (->> (org-x-dag-wkp-get-headline-inner y m d) - (org-x-dag-headlines-find-offset o)))) + (-when-let (abs (car (org-x-dag-weekly-span date))) + (let ((day-abs (org-x-dag-date-to-absolute date))) + (->> (org-x-dag-wkp-get-headline-inner abs) + (org-ml-headline-get-subheadlines) + (org-x-dag-headlines-find-date day-abs))))) (defun org-x-dag-wkp-set-headlines (date headlines) - (-let* (((y m d) (->> (org-x-dag->weekly-span) - (car) - (org-x-dag-absolute-to-date))) + (-let* ((abs (or (car (org-x-dag->weekly-span)) + ;; TODO this should all be one command (get weekly span or + ;; make a new one if not found) + (->> (org-x-dag-date-to-week-start date) + (org-x-dag-date-to-absolute)))) + ((y m d) (org-x-dag-absolute-to-date abs)) (path (org-x-dag->planning-file :weekly)) (find-year (-partial #'org-x-dag-headlines-find-year y)) (find-month (-partial #'org-x-dag-headlines-find-month m)) - (find-day (-partial #'org-x-dag-headlines-find-day d)) + (find-date (-partial #'org-x-dag-headlines-find-date abs)) (build-year (-partial #'org-x-dag-build-year-headline y)) (build-month (-partial #'org-x-dag-build-month-headline m)) - (build-day (-partial #'org-x-dag-build-day-headline date))) + (build-day (-partial #'org-x-dag-build-week-headline y m d 3))) (org-x-dag-headline-set-nested path headlines `((,find-year ,build-year) (,find-month ,build-month) - (,find-day ,build-day))))) + (,find-date ,build-day))))) ;; TODO these functions need to take dates and not 'week's (whatever those are) ;; (defun org-x-dag-wkp-get (date) @@ -3988,7 +4027,7 @@ FUTURE-LIMIT in a list." (org-x-dag-qtp-set-headlines date (org-x-dag-qtp-empty))) (defun org-x-dag--new-wkp (date) - (org-x-dag-wkp-set-headlines date (org-x-dag-wkp-empty))) + (org-x-dag-wkp-set-headlines date (org-x-dag-wkp-empty date))) (defun org-x-dag-new-qtp () (interactive) @@ -4463,9 +4502,9 @@ FUTURE-LIMIT in a list." (list))) (`(:quarterly :complete ,comptime) (list (format-comptime "quarterly plan" comptime))) - (`(:weekly :active) - "Active") - (`(:weekly :complete ,comptime) + (`(:weekly :leaf :active ,_) + '("Active")) + (`(:weekly :leaf :complete ,comptime) (list (format-comptime "weekly plan" comptime))) (`(:daily :active (:sched ,sched)) (-let (((y m d H M) (org-ml-timestamp-get-start-time sched))) From 9f0ca73f368206bf5394aec524bbe1299ac916d4 Mon Sep 17 00:00:00 2001 From: ndwarshuis Date: Wed, 18 May 2022 23:30:38 -0400 Subject: [PATCH 07/25] FIX repeated deadlines in agenda --- local/lib/org-x/org-x-dag.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/local/lib/org-x/org-x-dag.el b/local/lib/org-x/org-x-dag.el index 55d2dd5..7cc033a 100644 --- a/local/lib/org-x/org-x-dag.el +++ b/local/lib/org-x/org-x-dag.el @@ -2722,7 +2722,7 @@ FUTURE-LIMIT in a list." (`nil `(,datetime)) (`(,value ,unit ,reptype) (->> (org-x-dag-repeater-get-next cur datetime value unit reptype) - (--unfold (unless (org-x-dag-datetime< future-limit it) + (--unfold (when (org-x-dag-datetime< it future-limit) (cons it (org-x-dag-datetime-shift it value unit)))) (cons datetime)))))) From 8c4ba190b73b6c7081debebbc47bb931eb40101c Mon Sep 17 00:00:00 2001 From: ndwarshuis Date: Sun, 22 May 2022 15:31:42 -0400 Subject: [PATCH 08/25] ENH update packages --- straight/versions/default.el | 52 ++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/straight/versions/default.el b/straight/versions/default.el index 04cf57a..0644e84 100644 --- a/straight/versions/default.el +++ b/straight/versions/default.el @@ -1,4 +1,4 @@ -(("ESS" . "39eba283000a7b0220303d7c5a4f3ee05efc1e9c") +(("ESS" . "e83ac622fe7e3cbfc848481a9257e5ed5c7b5afb") ("Highlight-Indentation-for-Emacs" . "d88db4248882da2d4316e76ed673b4ac1fa99ce3") ("ace-window" . "0577c426a9833ab107bab46c60d1885c611b2fb9") ("anaconda-mode" . "cbea0fb3182321d34ff93981c5a59f8dd72d82a5") @@ -10,7 +10,7 @@ ("biblio.el" . "517ec18f00f91b61481214b178f7ae0b8fbc499b") ("blacken" . "563c744f545552cb92e8e84d5be4e2cdbabc93ca") ("c-eldoc" . "f4ede1f37f6de583376669735326367d84a0a917") - ("cider" . "69d374818bd0af1489ee8828b258c689ccc24a66") + ("cider" . "0dcc5b079a79a928b791cc9cd9bbd2e3bef92d0d") ("citeproc-el" . "ba49516265fa24b138346c4918d39d19b4de8a62") ("clang-format" . "e48ff8ae18dc7ab6118c1f6752deb48cb1fc83ac") ("clojure-mode" . "b6f41d74904daa9312648f3a7bea7a72fd8e140b") @@ -22,43 +22,43 @@ ("company-mode" . "d5145006b948f93e673f439a766da01f636d39fc") ("compat" . "1753ad6043a826ad7639dc99f3dd47ba59b6be79") ("conda.el" . "7a34e06931515d46f9e22154762e06e66cfbc81c") - ("csv-mode" . "180e0207be3f20a0054644b60e0cdda29b5ece4c") - ("dash.el" . "7fd71338dce041b352f84e7939f6966f4d379459") + ("csv-mode" . "53beddc207864b0c3f81da85b59245dff8eea5ce") + ("dash.el" . "759682332a0ebd737802d9fa0a80ceedf05088b6") ("delight" . "70cb8cec9e5eb2c24364e065d85c2ea8f14a587c") ("dired-du" . "4ce114a0195b852022a81b05f0c8e0cbbc1ed013") ("dired-hacks" . "7c0ef09d57a80068a11edc74c3568e5ead5cc15a") ("dockerfile-mode" . "b63a3d12b7dea0cb9efc7f78d7ad5672ceab2a3f") ("ebib" . "0e243a78f435038dda31953c5b48cbddf2a89e27") - ("el-get" . "9353309744e4f8a7c9b1adf22ec99536fb2146b0") + ("el-get" . "91352ca0f895d099f608644c8e9ad8e844b5c520") ("elpy" . "1746e7009000b7635c0ea6f1559018143aa61642") ("emacs-async" . "c78bab7506a70a735d2c3deab13fa87bf44a83d3") ("emacs-buttercup" . "ceedad5efa797e860dbb356bc2c3028a4e0321ec") ("emacs-calfw" . "03abce97620a4a7f7ec5f911e669da9031ab9088") - ("emacs-dashboard" . "09290bf700cc269ad3c07d9518cd758b90971fcd") - ("emacs-format-all-the-code" . "a07bf109ce8e27458a40420508943f53856549fc") + ("emacs-dashboard" . "a4eb09778f7b685b6ff652212bf1fa2e6e1305d7") + ("emacs-format-all-the-code" . "828280eaf3b46112e17746a7d03235570a633425") ("emacs-htmlize" . "dd27bc3f26efd728f2b1f01f9e4ac4f61f2ffbf9") ("emacs-language-id" . "5325af36d9cd726de47a698ac159fce59f3fd6d9") ("emacs-refactor" . "cac1b52932926f56d7f6d2923732d20bbd20670d") ("emacs-web-server" . "22ce66ea43e0eadb9ec1d691a35d9695fc29cee6") - ("emacs-which-key" . "129f4ebfc74f207ac82978f6d90d8b4bb1a55cf9") - ("emacsmirror-mirror" . "4f8608c90548a2d4a13f413f6fb2ab5338c267b4") + ("emacs-which-key" . "1ab1d0cc88843c9a614ed3226c5a1070e32e4823") + ("emacsmirror-mirror" . "378111b2b7846064679a063f4eec48ef6de39ce9") ("epl" . "78ab7a85c08222cd15582a298a364774e3282ce6") - ("evil" . "61a680042f422be715b42ceccb2418847c5f6b65") + ("evil" . "157af04d2cf466e301e82b0e667c5e7203fd96a2") ("evil-ReplaceWithRegister" . "91cc7bf21a94703c441cc9212214075b226b7f67") - ("evil-collection" . "9707efcae4fc76fa204b1c29565aae35b99b865a") + ("evil-collection" . "763e77f4b3763db250b4626e8cf7c5295d07a09a") ("evil-commentary" . "2dab6ac34d1617971768ad219d73af48f7473fec") ("evil-org-mode" . "0d10ff7bb9a3a93d25cd91018b17f0a052b335f3") ("evil-surround" . "c9e1449bf3f740b5e9b99e7820df4eca7fc7cf02") - ("f.el" . "b5cb884b3b4372a6f3d1d4428cf092ca1e5c8044") + ("f.el" . "e0dc429f9c20322c7af735a828fe2404bb416715") ("fill-column-indicator" . "c35f9de072c241699b57bcb46da84bed5af29cfe") - ("flycheck" . "1d7c1b20782ccbaa6f97e37f5e1d0cee3d5eda8a") + ("flycheck" . "66a973afca1d03b8284baaa7590eb2b8615a1e6a") ("flycheck-clang-analyzer" . "646d9f3a80046ab231a07526778695d5decad92d") ("flycheck-package" . "615c1ed8c6fb7c73abec6aaa73d3fef498d231bc") - ("flyspell-correct" . "e8027a412262bc04056a5b5440efdb7f370c3320") - ("gnu-elpa-mirror" . "85ee8c92e9587270fee01238b582574707ede515") + ("flyspell-correct" . "7d7b6b01188bd28e20a13736ac9f36c3367bd16e") + ("gnu-elpa-mirror" . "243cc013c3c97eeebf1d05423047689d59483a8e") ("goto-chg" . "278cd3e6d5107693aa2bb33189ca503f22f227d0") ("graphviz-dot-mode" . "6e96a89762760935a7dff6b18393396f6498f976") - ("haskell-mode" . "4ec2aa32b1772e629a6a2b47b84048e1990d6728") + ("haskell-mode" . "fe3a8046aa1e1767ddc11a74e3d45bd9c614e655") ("helm-bibtex" . "ce8c17690ddad73d01531084b282f221f8eb6669") ("ht.el" . "c4c1be487d6ecb353d07881526db05d7fc90ea87") ("hydra" . "9e9e00cb240ea1903ffd36a54956b3902c379d29") @@ -75,15 +75,15 @@ ("lispy" . "df1b7e614fb0f73646755343e8892ddda310f427") ("list-utils" . "ca9654cd1418e874c876c6b3b7d4cd8339bfde77") ("lua-mode" . "5a9bee8d5fc978dc64fcb677167417010321ba65") - ("magit" . "f331092df4d4dfc0a2a7424d929a9c845088d57f") + ("magit" . "a4a78d341a7006ccdec708b424048ba3b22ee801") ("map" . "9f46b9c966505874d68d9036827a4f63b55ab846") - ("markdown-mode" . "5b6e660c13ca3f4d15dbc1aa3d7ab2f228491ef9") + ("markdown-mode" . "4477f381de0068a04b55e198c32614793f67b38a") ("math-symbol-lists" . "590d9f09f8ad9aab747b97f077396a2035dcf50f") - ("melpa" . "6318c712774eff8dab62bcf13f9c70290d5d48ec") - ("no-littering" . "76b7335202a5b6ddc6b6798a2e2fd5b09df57dc2") + ("melpa" . "f3cbb8f0ec4406a862e1d0066d5c9868ab060391") + ("no-littering" . "fed46eb7060aca624bfe1a18f13b73f94e70f013") ("org-bullets" . "767f55feb58b840a5a04eabfc3fbbf0d257c4792") ("org-ml" . "3974435bbf72722801f7ed78855381d77a773162") - ("org-ref" . "a5a096b0c621fb42aa80cea14677bfb1d0df1f39") + ("org-ref" . "0d2355d1eb4dcac1095a03d885788a12fe566610") ("org-sql" . "71b6e01ff94be4c68cfeb17a34518bf1f118cf95") ("org-super-agenda" . "3108bc3f725818f0e868520d2c243abe9acbef4e") ("origami.el" . "e558710a975e8511b9386edc81cd6bdd0a5bda74") @@ -95,7 +95,7 @@ ("parseedn" . "a67204eeaa32ca8f11f6aeecc2a88349f196add6") ("password-store" . "c4d8a1d815e79ddd89a85d3e36a41d29f0475771") ("pcre2el" . "0b5b2a2c173aab3fd14aac6cf5e90ad3bf58fa7d") - ("pdf-tools" . "3ae9ba9ab9aaa03d1193667cb025a786bef9fe9a") + ("pdf-tools" . "f9ccdf99e560bae70d3a13325cec9dc0e3cc45b0") ("php-mode" . "4503672471b8fdaaea6c454344817a119c87fcc6") ("pkg-info" . "76ba7415480687d05a4353b27fea2ae02b8d9d61") ("pkgbuild-mode" . "8faee70e4640bd6ec1857651ec64e139e4dc2833") @@ -103,9 +103,9 @@ ("poly-markdown" . "d4ca396ec4a7d674ef0d671a6896f929ce5b504c") ("poly-noweb" . "3b0cd36ca9a707e8a09337a3468fa85d81fc461c") ("polymode" . "2094c92403fe395dfb2b8b2521da1012a966e9ab") - ("popup-el" . "3bf430270c74dad830ab9d776aab23cbf3ea3953") + ("popup-el" . "114d646f0f4dd49de19dfedd78630018f71470e5") ("powerline" . "566c77844f053cb39fa7acdfbc143a855450f0b5") - ("projectile" . "a4f86f981c84a546530d5904253fa266431ef806") + ("projectile" . "39314925e0813d9042911197b08cfe304baff350") ("pyenv-mode" . "b818901b8eac0e260ced66a6a5acabdbf6f5ba99") ("pythonic" . "fe75bc17baae314bf8f5e0b12aad3fccfc6c5397") ("pyvenv" . "31ea715f2164dd611e7fc77b26390ef3ca93509b") @@ -128,10 +128,10 @@ ("systemd-mode" . "b6ae63a236605b1c5e1069f7d3afe06ae32a7bae") ("tablist" . "faab7a035ef2258cc4ea2182f67e3aedab7e2af9") ("toc-org" . "bf2e4b358efbd860ecafe6e74776de0885d9d100") - ("transient" . "8c62d0d223e90f53b29c439ba2f86b6e721d8209") + ("transient" . "a0c69e5c712511a35d0ab53a5634420e9705149e") ("ts.el" . "3fee71ceefac71ba55eb34829d7e94bb3df37cee") ("use-package" . "a7422fb8ab1baee19adb2717b5b47b9c3812a84c") - ("with-editor" . "7348f6d5ff90318a1c948d0499d8dc6721fe851a") + ("with-editor" . "4ab8c6148bb2698ff793d4a8acdbd8d0d642e133") ("yaml-mode" . "535273d5a1eb76999d20afbcf4d9f056d8ffd2da") ("yasnippet" . "5cbdbf0d2015540c59ed8ee0fcf4788effdf75b6") ("zoutline" . "32857c6c4b9b0bcbed14d825a10b91a98d5fed0a")) From 843013884b2e6e6a3eec9c5d21df035c2b13dcb2 Mon Sep 17 00:00:00 2001 From: ndwarshuis Date: Sun, 22 May 2022 17:03:27 -0400 Subject: [PATCH 09/25] FIX make spans the correct length --- local/lib/org-x/org-x-dag.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/local/lib/org-x/org-x-dag.el b/local/lib/org-x/org-x-dag.el index 7cc033a..2864c8f 100644 --- a/local/lib/org-x/org-x-dag.el +++ b/local/lib/org-x/org-x-dag.el @@ -232,7 +232,7 @@ relative shift in days from ABS." acc) `((,abs . ,offset) ,@acc))))) (->> (-reduce-from #'to-interval nil date-offsets) - (--map `(,(car it) ,(+ 1 (car it) (cdr it))))))) + (--map `(,(car it) ,(+ (car it) (cdr it))))))) ;; date <-> quarter From 74fc4723cd1650384228a346ae1cb7c8a66ae21f Mon Sep 17 00:00:00 2001 From: ndwarshuis Date: Sun, 22 May 2022 17:03:49 -0400 Subject: [PATCH 10/25] FIX don't present a weekly plan if no span exists --- local/lib/org-x/org-x-dag.el | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/local/lib/org-x/org-x-dag.el b/local/lib/org-x/org-x-dag.el index 2864c8f..ae88a99 100644 --- a/local/lib/org-x/org-x-dag.el +++ b/local/lib/org-x/org-x-dag.el @@ -2559,13 +2559,13 @@ Return value is a list like (BUFFER NON-BUFFER)." (org-x-dag-date->qtp-ids))) (defun org-x-dag->current-wkp-ids () - (let ((span (org-x-dag->weekly-span))) + (-when-let (span (org-x-dag->weekly-span)) (cl-flet ((in-span (id) - (-when-let (bs (either-from-right (org-x-dag-id->bs id) id)) - (-let (((_ _ (&plist :date d :offset o)) bs)) - (interval-contains-p (+ d o) span))))) + (pcase (either-from-right (org-x-dag-id->bs id) id) + (`(:weekly :leaf :active ,abs) + (interval-contains-p abs span))))) (->> (org-x-dag->wkp-ids) (-filter #'in-span))))) @@ -3123,7 +3123,7 @@ FUTURE-LIMIT in a list." ;; and not doing these convoluted date checks (which won't work in all cases ;; anyways because they assume the week start will never change) (defun org-x-dag-itemize-wkp (files) - (let ((span (org-x-dag->weekly-span))) + (-when-let (span (org-x-dag->weekly-span)) (org-x-dag-with-ids files (pcase (either-from-right (org-x-dag-id->bs it) nil) (`(:weekly :leaf :active ,abs) From cfc944e2136e2209a1704f3be321c83b7253bd00 Mon Sep 17 00:00:00 2001 From: ndwarshuis Date: Sun, 22 May 2022 17:47:29 -0400 Subject: [PATCH 11/25] FIX consider iterators with all done subiterators as empty and not error --- local/lib/org-x/org-x-dag.el | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/local/lib/org-x/org-x-dag.el b/local/lib/org-x/org-x-dag.el index ae88a99..79c1875 100644 --- a/local/lib/org-x/org-x-dag.el +++ b/local/lib/org-x/org-x-dag.el @@ -906,9 +906,8 @@ deadline (eg via epoch time) or if it has a repeater." (`(:si-complete ,_) t) (_ nil))))) -(defun org-x-dag-bs-action-subiter-todo-fold (child-bss type-name active-key - default) - (declare (indent 1)) +(defun org-x-dag-bs-action-subiter-todo-fold (child-bss default trans-fun) + (declare (indent 2)) (org-x-dag-bs-action-rankfold-children child-bss default (lambda (acc next) (pcase `(,acc ,next) @@ -942,14 +941,7 @@ deadline (eg via epoch time) or if it has a repeater." (pcase next (`(:si-active ,_) t) (_ nil))) - (lambda (acc) - (pcase acc - (`(:si-complete ,_) - (->> type-name - (org-x-dag-left "Active %s must have at least one active child"))) - (`(:si-active ,ts-data) - (either :right `(,active-key ,ts-data))) - (e (error "Invalid pattern: %s" e)))))) + trans-fun)) (defun org-x-dag-node-is-iterator-p (node) (org-x-dag-node-data-is-iterator-p (plist-get node :node-meta))) @@ -972,8 +964,15 @@ deadline (eg via epoch time) or if it has a repeater." (either :left "Sub-iterator deadline must not start after parent")) ((equal it-todo org-x-kw-todo) (org-x-dag-bs-action-subiter-todo-fold child-bss - "sub-iterator" :si-active - `(:si-active (:sched ,sched :dead ,dead)))) + `(:si-active (:sched ,sched :dead ,dead)) + (lambda (acc) + (pcase acc + (`(:si-complete ,_) + (->> type-name + (org-x-dag-left "Active sub-iterator must have at least one active child"))) + (`(:si-active ,ts-data) + (either :right `(:si-active ,ts-data))) + (e (error "Invalid pattern: %s" e)))))) (t (org-x-dag-bs-error-kw "Sub-iterator" it-todo)))))) @@ -987,9 +986,13 @@ deadline (eg via epoch time) or if it has a repeater." (either :left "Iterators cannot be scheduled or deadlined")) ;; TODO also check for timeshift and archive props ((equal it-todo org-x-kw-todo) - (org-x-dag-bs-action-subiter-todo-fold child-bss - "iterator" :iter-active - '(:iter-empty))) + (org-x-dag-bs-action-subiter-todo-fold child-bss '(:iter-empty) + (lambda (acc) + (pcase acc + (`(:si-complete ,_) (either :right '(:iter-empty))) + (`(:si-active ,ts-data) + (either :right `(:iter-active ,ts-data))) + (e (error "Invalid pattern: %s" e)))))) (t (org-x-dag-bs-error-kw "Iterator" it-todo))))) From 225ad0efbc99e09c05d54fa28b5aa4fb2bcdb85e Mon Sep 17 00:00:00 2001 From: ndwarshuis Date: Sun, 22 May 2022 17:58:52 -0400 Subject: [PATCH 12/25] REF remove dead code --- local/lib/org-x/org-x-dag.el | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/local/lib/org-x/org-x-dag.el b/local/lib/org-x/org-x-dag.el index 79c1875..f87e68a 100644 --- a/local/lib/org-x/org-x-dag.el +++ b/local/lib/org-x/org-x-dag.el @@ -1665,9 +1665,7 @@ denoted by CUR-KEY with any errors that are found." ;; TODO what about repeaters? (-when-let (sched (org-x-dag-adjlist-id-planning-datetime adjlist :scheduled id)) - (when (and ;;(org-x-dag-date<= week-start sched) - ;;(org-x-dag-date<= sched week-end) - (not (org-x-dag-adjlist-id-done-p adjlist id)) + (when (and (not (org-x-dag-adjlist-id-done-p adjlist id)) committed-ids) (->> q-committed (--filter (-intersection committed-ids (cdr it))) From cd66eef37ca44b2670af2314dcef6fb53a0ad857 Mon Sep 17 00:00:00 2001 From: ndwarshuis Date: Sun, 22 May 2022 17:58:57 -0400 Subject: [PATCH 13/25] FIX properly query qtp deadline --- local/lib/org-x/org-x-dag.el | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/local/lib/org-x/org-x-dag.el b/local/lib/org-x/org-x-dag.el index f87e68a..e8074e8 100644 --- a/local/lib/org-x/org-x-dag.el +++ b/local/lib/org-x/org-x-dag.el @@ -4495,12 +4495,13 @@ FUTURE-LIMIT in a list." (ancestry-status (plist-get a :canceled-parent-p))) (list "Active" (format "Mask Status: %s" ancestry-status)))) - (`(:quarterly :active ,dead) - (->> (if dead (->> (org-ml-to-trimmed-string dead) + (`(:quarterly :active ,p) + (-let (((&plist :deadline dl) p)) + (->> (if dl (->> (org-ml-to-trimmed-string dl) (format "deadline: %s")) - "no deadline") - (format "Active with %s") - (list))) + "no deadline") + (format "Active with %s") + (list)))) (`(:quarterly :complete ,comptime) (list (format-comptime "quarterly plan" comptime))) (`(:weekly :leaf :active ,_) From 8fbf8afd109939c27a3f97aa69d48413e84a8829 Mon Sep 17 00:00:00 2001 From: ndwarshuis Date: Sun, 22 May 2022 18:05:32 -0400 Subject: [PATCH 14/25] FIX ensure network status is passed to agenda view properly --- local/lib/org-x/org-x-dag.el | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/local/lib/org-x/org-x-dag.el b/local/lib/org-x/org-x-dag.el index e8074e8..965f1de 100644 --- a/local/lib/org-x/org-x-dag.el +++ b/local/lib/org-x/org-x-dag.el @@ -3099,12 +3099,15 @@ FUTURE-LIMIT in a list." ((map-ns (ns) (-let (((&plist :planned p :committed c :scheduled-actions s) ns)) - (list (-intersection p wkp-ids) c s)))) + (list :planned (-intersection p wkp-ids) + :committed c + :scheduled-actions s)))) (org-x-dag-with-ids files (pcase (either-from-right (org-x-dag-id->bs it) nil) - (`(:quarterly :active ,dead) - (let* ((tags (org-x-dag-id->tags it)) - (date (org-x-dag-quarter-tags-to-date tags))) + (`(:quarterly :active ,p) + (-let* (((&plist :deadline dead) p) + (tags (org-x-dag-id->tags it)) + (date (org-x-dag-quarter-tags-to-date tags))) (when (org-x-dag-datetime= q-date date) ;; TODO this network status thing should probably be a feature ;; in all planning nodes, since we are guaranteed to have a @@ -4916,7 +4919,10 @@ In the order of display (-let* ((ns (get-text-property 1 'x-network-status line)) ((rank text) (if (not ns) '(0 "No Network Status") - (-let (((p s c) ns)) + (-let (((&plist :planned p + :scheduled-actions s + :committed c) + ns)) (cond ((and s c) '(5 "Committed | Scheduled")) From 85be0e64bde08c81febbce2c7058a35c006b3358 Mon Sep 17 00:00:00 2001 From: ndwarshuis Date: Sun, 22 May 2022 23:01:32 -0400 Subject: [PATCH 15/25] FIX don't add extra datetime when repeat happens to land on selected date --- local/lib/org-x/org-x-dag.el | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/local/lib/org-x/org-x-dag.el b/local/lib/org-x/org-x-dag.el index 965f1de..021a9ce 100644 --- a/local/lib/org-x/org-x-dag.el +++ b/local/lib/org-x/org-x-dag.el @@ -2699,7 +2699,6 @@ encountered will be returned." (unless (car it) (let* ((next (org-x-dag-datetime-shift (cdr it) shift shifttype)) (futurep (org-x-dag-datetime< sel-datetime next))) - ;; (futurep (org-x-dag-date< sel-datetime next))) `(,next . (,futurep . ,next))))) (-last-item))) ('restart @@ -2722,10 +2721,13 @@ FUTURE-LIMIT in a list." (pcase rep (`nil `(,datetime)) (`(,value ,unit ,reptype) - (->> (org-x-dag-repeater-get-next cur datetime value unit reptype) - (--unfold (when (org-x-dag-datetime< it future-limit) - (cons it (org-x-dag-datetime-shift it value unit)))) - (cons datetime)))))) + (let* ((next (org-x-dag-repeater-get-next cur datetime value unit reptype)) + (reps + (--unfold (when (org-x-dag-datetime< it future-limit) + (cons it (org-x-dag-datetime-shift it value unit))) + next))) + (if (org-x-dag-datetime= next datetime) reps + (cons datetime reps))))))) (defun org-x-dag-get-scheduled-at (sel-date pts) (-let* (((&plist :datetime d :repeater r) pts) From 20c3dece24e7ccf2935a1c39b77aad8cb27eec97 Mon Sep 17 00:00:00 2001 From: ndwarshuis Date: Sun, 22 May 2022 23:34:53 -0400 Subject: [PATCH 16/25] FIX future scheduled timestamps not showing up --- local/lib/org-x/org-x-dag.el | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/local/lib/org-x/org-x-dag.el b/local/lib/org-x/org-x-dag.el index 021a9ce..8dfefcc 100644 --- a/local/lib/org-x/org-x-dag.el +++ b/local/lib/org-x/org-x-dag.el @@ -2717,7 +2717,7 @@ If REP is nil, return a singleton list just containing DATETIME. If REP is non-nil, return DATETIME and all repeaters up until FUTURE-LIMIT in a list." ;; ASSUME pts and future-limit are both long or short timestamps - (unless (org-x-dag-datetime< future-limit datetime) + (when (org-x-dag-datetime< datetime future-limit) (pcase rep (`nil `(,datetime)) (`(,value ,unit ,reptype) @@ -2732,11 +2732,12 @@ FUTURE-LIMIT in a list." (defun org-x-dag-get-scheduled-at (sel-date pts) (-let* (((&plist :datetime d :repeater r) pts) (islongp (org-ml-time-is-long d)) + (sel-date+ (org-x-dag-datetime-shift sel-date 1 'submonth)) ((future-limit cur) (if islongp - `((,@sel-date 23 59) + `((,@sel-date+ 0 0) ,(org-x-dag-current-datetime)) - `(,sel-date ,(org-x-dag-current-date))))) + `(,sel-date+ ,(org-x-dag-current-date))))) (org-x-dag-unfold-timestamp cur d r future-limit))) (defun org-x-dag-get-deadlines-at (sel-date pts) @@ -2751,7 +2752,9 @@ FUTURE-LIMIT in a list." `(,(org-x-dag-date-at-current-time sel-date) ,(org-x-dag-current-datetime)) `(,sel-date ,(org-x-dag-current-date)))) - (future-limit (org-x-dag-datetime-shift sel-datetime warn-shift warn-shifttype))) + (future-limit (org-x-dag-datetime-shift sel-datetime + (1+ warn-shift) + warn-shifttype))) (org-x-dag-unfold-timestamp cur d r future-limit))) (defun org-x-dag-id->marker (id &optional point) From 7a3532ed905430de245199149e15ec0f8db72fa9 Mon Sep 17 00:00:00 2001 From: ndwarshuis Date: Sun, 22 May 2022 23:40:52 -0400 Subject: [PATCH 17/25] FIX make datetimes that aren't on the current date not show their HHMM --- local/lib/org-x/org-x-dag.el | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/local/lib/org-x/org-x-dag.el b/local/lib/org-x/org-x-dag.el index 8dfefcc..680f778 100644 --- a/local/lib/org-x/org-x-dag.el +++ b/local/lib/org-x/org-x-dag.el @@ -3286,19 +3286,26 @@ FUTURE-LIMIT in a list." (if todayp datetimes (--drop-while (org-x-dag-date< it sel-date) datetimes))))) (expand-datetimes - (id donep which dt-fun) + (id donep which dt-fun post-fun) (-when-let (pts (-some->> (org-x-dag-id->planning-timestamp which id) (org-x-dag-partition-timestamp))) (-when-let (ds (get-datetimes donep dt-fun pts)) (-let ((tags (org-x-dag-id->tags id)) ((&plist :pos) pts)) - (--map (list :pos pos :datetime it :tags tags :id id) ds))))) + (->> (-map post-fun ds) + (--map (list :pos pos :datetime it :tags tags :id id))))))) (scheduled-datetimes (id donep) - (expand-datetimes id donep :scheduled #'org-x-dag-get-scheduled-at)) + (expand-datetimes id donep :scheduled + #'org-x-dag-get-scheduled-at + #'identity)) (deadlined-datetimes (id donep) - (expand-datetimes id donep :deadline #'org-x-dag-get-deadlines-at)) + (expand-datetimes id donep :deadline + #'org-x-dag-get-deadlines-at + (lambda (datetime) + (if (org-x-dag-date= datetime sel-date) datetime + (car (org-x-dag-datetime-split datetime)))))) (add-sched (acc id donep) (-let (((acc-d acc-s) acc) From 582e938e50d343f677e7d7c532c75df5a1f255f1 Mon Sep 17 00:00:00 2001 From: ndwarshuis Date: Fri, 27 May 2022 21:36:04 -0400 Subject: [PATCH 18/25] ADD logic to tell if iterators need to be refilled (oops) --- local/lib/org-x/org-x-dag.el | 48 +++++++++++++++++++++++++++--------- 1 file changed, 36 insertions(+), 12 deletions(-) diff --git a/local/lib/org-x/org-x-dag.el b/local/lib/org-x/org-x-dag.el index 680f778..fccd69f 100644 --- a/local/lib/org-x/org-x-dag.el +++ b/local/lib/org-x/org-x-dag.el @@ -62,6 +62,12 @@ (defun org-x-dag-time-is-archivable-p (epochtime) (< (* 60 60 24 org-x-archive-delay) (- (float-time) epochtime))) +;; org ml wrappers + +(defun org-x-dag-timestamp-to-epoch (ts) + (->> (org-ml-timestamp-get-start-time ts) + (org-ml-time-to-unixtime))) + ;; calendar interface (defun org-x-dag-gregorian-to-date (greg) @@ -3023,16 +3029,31 @@ FUTURE-LIMIT in a list." (list)))))))))) (defun org-x-dag-itemize-iterators (files) - (org-x-dag-with-unmasked-action-ids files - (pcase it-local - (`(:sp-iter . ,status-data) - (let ((status (car status-data))) - (when (memq status '(:iter-empty :iter-active)) - (let ((tags (org-x-dag-id->tags it))) - (-> (org-x-dag-format-tag-node tags it) - (org-add-props nil - 'x-status status) - (list))))))))) + (cl-flet + ((get-status + (data) + (pcase data + (`(:iter-empty) :empty) + (`(:iter-active ,data) + (-let* (((&plist :dead d :sched s) data) + (d* (-some->> d (org-x-dag-timestamp-to-epoch))) + (s* (-some->> s (org-x-dag-timestamp-to-epoch)))) + (-if-let (epoch (if (and d* s*) (min d* s*) (or s* d*))) + (if (< (+ (float-time) org-x-iterator-active-future-offset) + epoch) + :active + :refill) + :unknown))) + (`(:iter-complete ,_) :complete)))) + (org-x-dag-with-unmasked-action-ids files + (pcase it-local + (`(:sp-iter . ,status-data) + (let ((status (get-status status-data)) + (tags (org-x-dag-id->tags it))) + (-> (org-x-dag-format-tag-node tags it) + (org-add-props nil + 'x-status status) + (list)))))))) (defun org-x-dag-itemize-incubated (files) (org-x-dag-with-unmasked-action-ids files @@ -5041,8 +5062,11 @@ review phase)" (lambda (line) (let ((s (get-text-property 1 'x-status line))) (pcase s - (:iter-empty "1. Empty") - (:iter-active "2. Active"))))))))))) + (:unknown "0. Unknown") + (:complete "1. Refill") + (:empty "2. Empty") + (:refill "3. Refill") + (:active "4. Active"))))))))))) (defun org-x-dag-agenda-errors () "Show the critical errors agenda view." From 7fe062b7f875ecbab1cc8858b9b6c02f8909c07e Mon Sep 17 00:00:00 2001 From: ndwarshuis Date: Mon, 30 May 2022 15:47:47 -0400 Subject: [PATCH 19/25] ENH update packages --- straight/versions/default.el | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/straight/versions/default.el b/straight/versions/default.el index 0644e84..b4d9219 100644 --- a/straight/versions/default.el +++ b/straight/versions/default.el @@ -8,9 +8,9 @@ ("avy" . "ba5f035be33693d1a136a5cbeedb24327f551a92") ("beacon" . "bde78180c678b233c94321394f46a81dc6dce1da") ("biblio.el" . "517ec18f00f91b61481214b178f7ae0b8fbc499b") - ("blacken" . "563c744f545552cb92e8e84d5be4e2cdbabc93ca") + ("blacken" . "764912ada13c3bf57e770fcd978c81a1ce26666a") ("c-eldoc" . "f4ede1f37f6de583376669735326367d84a0a917") - ("cider" . "0dcc5b079a79a928b791cc9cd9bbd2e3bef92d0d") + ("cider" . "b2dd4a7d9def83d420424fcaf69fd791198a264b") ("citeproc-el" . "ba49516265fa24b138346c4918d39d19b4de8a62") ("clang-format" . "e48ff8ae18dc7ab6118c1f6752deb48cb1fc83ac") ("clojure-mode" . "b6f41d74904daa9312648f3a7bea7a72fd8e140b") @@ -20,32 +20,32 @@ ("company-irony" . "b44711dfce445610c1ffaec4951c6ff3882b216a") ("company-math" . "45778f5731c97a21a83e3b965cbde42018709afd") ("company-mode" . "d5145006b948f93e673f439a766da01f636d39fc") - ("compat" . "1753ad6043a826ad7639dc99f3dd47ba59b6be79") + ("compat" . "81378ce2549e6c6df5141d459036438cb98b9ad3") ("conda.el" . "7a34e06931515d46f9e22154762e06e66cfbc81c") ("csv-mode" . "53beddc207864b0c3f81da85b59245dff8eea5ce") - ("dash.el" . "759682332a0ebd737802d9fa0a80ceedf05088b6") + ("dash.el" . "76606f90774c5349f7adac20c33e6d37a1939a1f") ("delight" . "70cb8cec9e5eb2c24364e065d85c2ea8f14a587c") ("dired-du" . "4ce114a0195b852022a81b05f0c8e0cbbc1ed013") ("dired-hacks" . "7c0ef09d57a80068a11edc74c3568e5ead5cc15a") ("dockerfile-mode" . "b63a3d12b7dea0cb9efc7f78d7ad5672ceab2a3f") ("ebib" . "0e243a78f435038dda31953c5b48cbddf2a89e27") - ("el-get" . "91352ca0f895d099f608644c8e9ad8e844b5c520") + ("el-get" . "a620c91fe7d6d482c0e7538df75e10af0af1bb16") ("elpy" . "1746e7009000b7635c0ea6f1559018143aa61642") ("emacs-async" . "c78bab7506a70a735d2c3deab13fa87bf44a83d3") ("emacs-buttercup" . "ceedad5efa797e860dbb356bc2c3028a4e0321ec") ("emacs-calfw" . "03abce97620a4a7f7ec5f911e669da9031ab9088") - ("emacs-dashboard" . "a4eb09778f7b685b6ff652212bf1fa2e6e1305d7") + ("emacs-dashboard" . "1e691b346b9220b73337fd4962bbe6ef775ad9e7") ("emacs-format-all-the-code" . "828280eaf3b46112e17746a7d03235570a633425") ("emacs-htmlize" . "dd27bc3f26efd728f2b1f01f9e4ac4f61f2ffbf9") ("emacs-language-id" . "5325af36d9cd726de47a698ac159fce59f3fd6d9") ("emacs-refactor" . "cac1b52932926f56d7f6d2923732d20bbd20670d") ("emacs-web-server" . "22ce66ea43e0eadb9ec1d691a35d9695fc29cee6") ("emacs-which-key" . "1ab1d0cc88843c9a614ed3226c5a1070e32e4823") - ("emacsmirror-mirror" . "378111b2b7846064679a063f4eec48ef6de39ce9") + ("emacsmirror-mirror" . "f5e5fc8fb9c6dd5d9319819ab0161a9f78c2e657") ("epl" . "78ab7a85c08222cd15582a298a364774e3282ce6") ("evil" . "157af04d2cf466e301e82b0e667c5e7203fd96a2") ("evil-ReplaceWithRegister" . "91cc7bf21a94703c441cc9212214075b226b7f67") - ("evil-collection" . "763e77f4b3763db250b4626e8cf7c5295d07a09a") + ("evil-collection" . "e1bbf13194e06c435cd3328b2b431c9c46fbbf40") ("evil-commentary" . "2dab6ac34d1617971768ad219d73af48f7473fec") ("evil-org-mode" . "0d10ff7bb9a3a93d25cd91018b17f0a052b335f3") ("evil-surround" . "c9e1449bf3f740b5e9b99e7820df4eca7fc7cf02") @@ -55,10 +55,10 @@ ("flycheck-clang-analyzer" . "646d9f3a80046ab231a07526778695d5decad92d") ("flycheck-package" . "615c1ed8c6fb7c73abec6aaa73d3fef498d231bc") ("flyspell-correct" . "7d7b6b01188bd28e20a13736ac9f36c3367bd16e") - ("gnu-elpa-mirror" . "243cc013c3c97eeebf1d05423047689d59483a8e") + ("gnu-elpa-mirror" . "808923d95777d378ca340b8020dd571e6a62460a") ("goto-chg" . "278cd3e6d5107693aa2bb33189ca503f22f227d0") ("graphviz-dot-mode" . "6e96a89762760935a7dff6b18393396f6498f976") - ("haskell-mode" . "fe3a8046aa1e1767ddc11a74e3d45bd9c614e655") + ("haskell-mode" . "5a9f8072c7b9168f0a8409adf9d62a3e4ad4ea3d") ("helm-bibtex" . "ce8c17690ddad73d01531084b282f221f8eb6669") ("ht.el" . "c4c1be487d6ecb353d07881526db05d7fc90ea87") ("hydra" . "9e9e00cb240ea1903ffd36a54956b3902c379d29") @@ -75,19 +75,20 @@ ("lispy" . "df1b7e614fb0f73646755343e8892ddda310f427") ("list-utils" . "ca9654cd1418e874c876c6b3b7d4cd8339bfde77") ("lua-mode" . "5a9bee8d5fc978dc64fcb677167417010321ba65") - ("magit" . "a4a78d341a7006ccdec708b424048ba3b22ee801") + ("magit" . "4b8eab3af130c47421482c1d28c1cbcb033106fc") ("map" . "9f46b9c966505874d68d9036827a4f63b55ab846") ("markdown-mode" . "4477f381de0068a04b55e198c32614793f67b38a") ("math-symbol-lists" . "590d9f09f8ad9aab747b97f077396a2035dcf50f") - ("melpa" . "f3cbb8f0ec4406a862e1d0066d5c9868ab060391") - ("no-littering" . "fed46eb7060aca624bfe1a18f13b73f94e70f013") + ("melpa" . "6ade7599f12a93517f24f5871091fa74c6c2e387") + ("no-littering" . "a5aa3faada054f96b70b32ba9d9447f7a4cf403c") ("org-bullets" . "767f55feb58b840a5a04eabfc3fbbf0d257c4792") ("org-ml" . "3974435bbf72722801f7ed78855381d77a773162") - ("org-ref" . "0d2355d1eb4dcac1095a03d885788a12fe566610") + ("org-ref" . "2d91eba9274a79f908723a4a215e0f0b5c04ed01") ("org-sql" . "71b6e01ff94be4c68cfeb17a34518bf1f118cf95") ("org-super-agenda" . "3108bc3f725818f0e868520d2c243abe9acbef4e") ("origami.el" . "e558710a975e8511b9386edc81cd6bdd0a5bda74") ("outline-magic" . "2a5f07417b696cf7541d435c43bafcc64817636b") + ("ox-pandoc" . "0a35d0fbfa56bdd9ec5ba5bac2fe002b61c05c52") ("package-lint" . "80a9d9815ab2919c992ad29ae4846443dec43a35") ("paredit" . "8330a41e8188fe18d3fa805bb9aa529f015318e8") ("parsebib" . "dd4c5540fa6c2cd990cba324741d7abbc8ed2f23") @@ -105,7 +106,7 @@ ("polymode" . "2094c92403fe395dfb2b8b2521da1012a966e9ab") ("popup-el" . "114d646f0f4dd49de19dfedd78630018f71470e5") ("powerline" . "566c77844f053cb39fa7acdfbc143a855450f0b5") - ("projectile" . "39314925e0813d9042911197b08cfe304baff350") + ("projectile" . "e60883ff370c1545499b97cf56479de1a58c5b3b") ("pyenv-mode" . "b818901b8eac0e260ced66a6a5acabdbf6f5ba99") ("pythonic" . "fe75bc17baae314bf8f5e0b12aad3fccfc6c5397") ("pyvenv" . "31ea715f2164dd611e7fc77b26390ef3ca93509b") @@ -124,11 +125,11 @@ ("straight.el" . "af5437f2afd00936c883124d6d3098721c2d306c") ("string-inflection" . "fd7926ac17293e9124b31f706a4e8f38f6a9b855") ("sudo-edit" . "23b78a39053088839f281bc0c3134203d7e04e50") - ("swiper" . "8bf8027e4bd8c093bddb76a813952d2a0dcbf21d") + ("swiper" . "f8d80a4055514f92d94f128f5fcb1cda79e5cd22") ("systemd-mode" . "b6ae63a236605b1c5e1069f7d3afe06ae32a7bae") ("tablist" . "faab7a035ef2258cc4ea2182f67e3aedab7e2af9") ("toc-org" . "bf2e4b358efbd860ecafe6e74776de0885d9d100") - ("transient" . "a0c69e5c712511a35d0ab53a5634420e9705149e") + ("transient" . "2e4426fe8161893382f09b3f4635e152ee02488e") ("ts.el" . "3fee71ceefac71ba55eb34829d7e94bb3df37cee") ("use-package" . "a7422fb8ab1baee19adb2717b5b47b9c3812a84c") ("with-editor" . "4ab8c6148bb2698ff793d4a8acdbd8d0d642e133") From 84b06e1a420c1d1f1d9da090fa406b9ebdabf429 Mon Sep 17 00:00:00 2001 From: ndwarshuis Date: Mon, 30 May 2022 15:47:56 -0400 Subject: [PATCH 20/25] FIX typo --- local/lib/org-x/org-x-dag.el | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/local/lib/org-x/org-x-dag.el b/local/lib/org-x/org-x-dag.el index fccd69f..1ca609f 100644 --- a/local/lib/org-x/org-x-dag.el +++ b/local/lib/org-x/org-x-dag.el @@ -974,8 +974,7 @@ deadline (eg via epoch time) or if it has a repeater." (lambda (acc) (pcase acc (`(:si-complete ,_) - (->> type-name - (org-x-dag-left "Active sub-iterator must have at least one active child"))) + (org-x-dag-left "Active sub-iterator must have at least one active child")) (`(:si-active ,ts-data) (either :right `(:si-active ,ts-data))) (e (error "Invalid pattern: %s" e)))))) From c081c34a431f1c3037c34af3c6c0b9e3e8a61d24 Mon Sep 17 00:00:00 2001 From: ndwarshuis Date: Wed, 1 Jun 2022 18:34:23 -0400 Subject: [PATCH 21/25] ENH remove gatech email --- etc/conf.org | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/etc/conf.org b/etc/conf.org index 0320dd7..c5d1960 100644 --- a/etc/conf.org +++ b/etc/conf.org @@ -3762,12 +3762,7 @@ Initialize by running =nd/mu-init=. "gmail" "natedwarshuis@gmail.com" "smtp.gmail.com" - 'delete) - (nd/make-mu4e-context "gatech" - "gatech" - "ndwarshuis3@gatech.edu" - "smtp.office365.com" - 'sent))) + 'delete))) ;; enable visual line mode and spell checking (add-hook 'mu4e-compose-mode-hook 'turn-off-auto-fill) @@ -3836,13 +3831,9 @@ Initialize by running =nd/mu-init=. (s-trim))) (defun nd/xoauth2-get-secrets (host user port) - (when - (or (and (string= host "smtp.office365.com") - (string= user "ndwarshuis3@gatech.edu") - (string= port "587")) - (and (string= host "smtp.gmail.com") - (string= user "natedwarshuis@gmail.com") - (string= port "587"))) + (when (and (string= host "smtp.gmail.com") + (string= user "natedwarshuis@gmail.com") + (string= port "587")) (list :token-url (nd/lookup-oauth-secret "token_url" user) :client-id (nd/lookup-oauth-secret "client_id" user) :client-secret (nd/lookup-oauth-secret "client_secret" user) From 6aaa5138569ef45c130839da04e31966fcb044c0 Mon Sep 17 00:00:00 2001 From: ndwarshuis Date: Wed, 1 Jun 2022 18:34:30 -0400 Subject: [PATCH 22/25] ENH show overdue deadlines --- local/lib/org-x/org-x-dag.el | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/local/lib/org-x/org-x-dag.el b/local/lib/org-x/org-x-dag.el index 1ca609f..a1835ea 100644 --- a/local/lib/org-x/org-x-dag.el +++ b/local/lib/org-x/org-x-dag.el @@ -3296,32 +3296,41 @@ FUTURE-LIMIT in a list." (defun org-x-dag-itemize-agenda (files sel-date) (let ((todayp (org-x-dag-date= (org-x-dag-current-date) sel-date))) (cl-flet* - ((get-datetimes - (donep dt-fun pts) + ((past-p + (datetime) + (org-x-dag-date< datetime sel-date)) + (get-datetimes + (donep keep-most-recent-p dt-fun pts) (if donep (-let (((&plist :datetime) pts)) (when (org-x-dag-date= datetime sel-date) `(,datetime))) (-when-let (datetimes (funcall dt-fun sel-date pts)) - (if todayp datetimes - (--drop-while (org-x-dag-date< it sel-date) datetimes))))) + (cond + (todayp + datetimes) + (keep-most-recent-p + (-let (((past rest) (-split-with #'past-p datetimes))) + (if past (cons (-last-item past) rest) rest))) + (t + (-drop-while #'past-p datetimes)))))) (expand-datetimes - (id donep which dt-fun post-fun) + (id donep keep-past-p which dt-fun post-fun) (-when-let (pts (-some->> (org-x-dag-id->planning-timestamp which id) (org-x-dag-partition-timestamp))) - (-when-let (ds (get-datetimes donep dt-fun pts)) + (-when-let (ds (get-datetimes donep keep-past-p dt-fun pts)) (-let ((tags (org-x-dag-id->tags id)) ((&plist :pos) pts)) (->> (-map post-fun ds) (--map (list :pos pos :datetime it :tags tags :id id))))))) (scheduled-datetimes (id donep) - (expand-datetimes id donep :scheduled + (expand-datetimes id donep nil :scheduled #'org-x-dag-get-scheduled-at #'identity)) (deadlined-datetimes (id donep) - (expand-datetimes id donep :deadline + (expand-datetimes id donep t :deadline #'org-x-dag-get-deadlines-at (lambda (datetime) (if (org-x-dag-date= datetime sel-date) datetime From c1998b6ede38459c47ae683dc18d01575858b92f Mon Sep 17 00:00:00 2001 From: ndwarshuis Date: Wed, 1 Jun 2022 18:55:22 -0400 Subject: [PATCH 23/25] ENH make weekly plan start on proper day of week --- local/lib/org-x/org-x-dag.el | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/local/lib/org-x/org-x-dag.el b/local/lib/org-x/org-x-dag.el index a1835ea..7f591a3 100644 --- a/local/lib/org-x/org-x-dag.el +++ b/local/lib/org-x/org-x-dag.el @@ -178,9 +178,17 @@ ;; date <-> week -;; (defun org-x-dag-date-to-day-of-week (date) -;; (->> (org-x-dag-date-to-gregorian date) -;; (calendar-day-of-week))) +(defvar org-x-dag-weekday-start 1 + "Index of day to be considered start of week. +Must be an integer from 0 - 6, with 0 = Sunday.") + +(defun org-x-dag-abs-to-day-of-week (abs) + (-> (- abs org-x-dag-weekday-start) + (mod 7))) + +(defun org-x-dag-date-to-day-of-week (date) + (-> (org-x-dag-date-to-absolute date) + (org-x-dag-abs-to-day-of-week))) (defun org-x-dag-date-to-week-number (date) (-let* (((y m d) date) @@ -205,10 +213,6 @@ (+ start-abs start-diff) (org-x-dag-absolute-to-date)))) -(defvar org-x-dag-weekday-start 1 - "Index of day to be considered start of week. -Must be an integer from 0 - 6, with 0 = Sunday.") - (defun org-x-dag-date-to-week-start (date) "" (let* ((abs (-> (org-x-dag-date-to-absolute date) @@ -283,6 +287,11 @@ relative shift in days from ABS." (5 . "Friday") (6 . "Saturday"))) +(defun org-x-dag-day-of-week-to-tag (n) + (-> (+ n org-x-dag-weekday-start) + (mod 7) + (alist-get org-x-dag-weekly-tags))) + (defun org-x-dag--parse-date-tag (prefix tag) (let ((re (format "%s\\([0-9]+\\)" prefix))) (-some->> (s-match re tag) @@ -3156,8 +3165,7 @@ FUTURE-LIMIT in a list." (org-x-dag-with-ids files (pcase (either-from-right (org-x-dag-id->bs it) nil) (`(:weekly :leaf :active ,abs) - (let ((day (->> (calendar-gregorian-from-absolute abs) - (calendar-day-of-week)))) + (let ((day (org-x-dag-abs-to-day-of-week abs))) (when (interval-contains-p abs span) (let ((ns (-some-> (org-x-dag-id->ns it) (either-from (-const nil) #'identity))) @@ -4992,8 +5000,7 @@ In the order of display (lambda (line) (-let* ((ns (get-text-property 1 'x-network-status line)) (day (get-text-property 1 'x-day line)) - ;; TODO not sure if this will work anymore - (day-name (alist-get day org-x-dag-weekly-tags)) + (day-name (org-x-dag-day-of-week-to-tag day)) ((rank text) (if (not ns) '(0 "No Network Status") (-let (((&plist :planned p :committed c) ns)) From 89d1e05b9289b8b052c29ccc7affde56083f582d Mon Sep 17 00:00:00 2001 From: ndwarshuis Date: Wed, 1 Jun 2022 19:08:24 -0400 Subject: [PATCH 24/25] FIX compile errors --- local/lib/org-x/org-x-dag.el | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/local/lib/org-x/org-x-dag.el b/local/lib/org-x/org-x-dag.el index 7f591a3..0d13d8f 100644 --- a/local/lib/org-x/org-x-dag.el +++ b/local/lib/org-x/org-x-dag.el @@ -1221,7 +1221,7 @@ deadline (eg via epoch time) or if it has a repeater." (date-abs (org-x-dag-date-to-absolute date))) (cl-flet ((mk-right - (dead date) + (dead) (either :right `(:active (:deadline ,dead :date ,date-abs))))) (org-x-dag-bs-with-closed node-data "quarterly plan" `(:complete (,@it-comptime :date ,date-abs)) @@ -1238,7 +1238,7 @@ deadline (eg via epoch time) or if it has a repeater." (org-x-dag-datetime-split) (car)))) (if (org-x-dag-datetime< date dead-dt) - (mk-right dead date-abs) + (mk-right dead) (->> "QTP deadlines must be due after the quarter starts" (either :left)))) (mk-right nil date-abs))) @@ -1261,7 +1261,7 @@ deadline (eg via epoch time) or if it has a repeater." (t (org-x-dag-bs-error-kw "WKP" it-todo))))))) -(defun org-x-dag-bs-wkp-branch-inner (node-data ancestry child-bss) +(defun org-x-dag-bs-wkp-branch-inner (node-data ancestry _) (either>>= ancestry (org-x-dag-bs-with-closed node-data "weekly plan" `(:branch :complete ,it-comptime) @@ -1274,7 +1274,7 @@ deadline (eg via epoch time) or if it has a repeater." (t (org-x-dag-bs-error-kw "WKP day node" it-todo)))))) -(defun org-x-dag-bs-wkp-root-inner (node-data ancestry child-bss) +(defun org-x-dag-bs-wkp-root-inner (node-data ancestry _) (either>>= ancestry (org-x-dag-bs-with-closed node-data "weekly plan" `(:root :complete ,it-comptime) @@ -1647,7 +1647,7 @@ denoted by CUR-KEY with any errors that are found." (->> (if (is-valid-leaf-p id) (either :right `(:committed ,q)) (-> "WKP links can only originate from leaves" - (org-x-dag--ns-err))) + (org-x-dag--ns-err (list id)))) (ht-set this-h id)) (org-x-dag-ht-add-links id ht-q :planned q))))))) @@ -3864,7 +3864,7 @@ FUTURE-LIMIT in a list." (defun org-x-dag-wkp-get-headline-inner (date-abs) (org-x-with-file (org-x-dag->planning-file :weekly) - (-let (((m d y) (calendar-gregorian-from-absolute date-abs))) + (-let (((m _ y) (calendar-gregorian-from-absolute date-abs))) (->> (org-ml-parse-subtrees 'all) (org-x-dag-headlines-find-year y) (org-ml-headline-get-subheadlines) From 5df1cdfa77b804c9901655311d751a3f68973c63 Mon Sep 17 00:00:00 2001 From: ndwarshuis Date: Wed, 1 Jun 2022 22:54:01 -0400 Subject: [PATCH 25/25] FIX typo --- local/lib/org-x/org-x-dag.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/local/lib/org-x/org-x-dag.el b/local/lib/org-x/org-x-dag.el index 0d13d8f..e478222 100644 --- a/local/lib/org-x/org-x-dag.el +++ b/local/lib/org-x/org-x-dag.el @@ -830,7 +830,7 @@ deadline (eg via epoch time) or if it has a repeater." `(:sp-proj :proj-wait) `(:sp-proj :proj-held) `(:sp-proj :proj-stuck) - `(:sp-iter :iter-active) + `(:sp-iter :iter-active ,_) `(:sp-iter :iter-empty)) (:sp-task :task-active ,d)) (is-next d))