ADD test for DONE timestamp shifter

This commit is contained in:
Nathan Dwarshuis 2021-06-06 10:29:44 -04:00
parent f5620870c4
commit 668ac6a825
2 changed files with 39 additions and 11 deletions

View File

@ -1105,23 +1105,27 @@ timestamp in the contents of the headline will be shifted."
(cl-labels (cl-labels
((shift-timestamps ((shift-timestamps
(offset unit subtree) (offset unit subtree)
(if (not (member (org-ml-get-property :todo-keyword subtree) (let ((kw (org-ml-get-property :todo-keyword subtree)))
org-x-done-keywords)) (cond
((null kw)
(org-ml-headline-map-contents* (org-x-logbook-config)
;; wrap in a section here because the matcher needs a single node
;; and not a list
(->> (apply #'org-ml-build-section it)
(org-ml-match-map* org-x--first-active-ts-pattern
(org-ml-timestamp-shift offset unit it))
(org-ml-get-children))
subtree))
((member kw org-x-done-keywords)
subtree)
(t
(org-ml-headline-map-planning* (org-ml-headline-map-planning*
(-some->> it (-some->> it
(org-ml-map-property* :scheduled (org-ml-map-property* :scheduled
(when it (org-ml-timestamp-shift offset unit it))) (when it (org-ml-timestamp-shift offset unit it)))
(org-ml-map-property* :deadline (org-ml-map-property* :deadline
(when it (org-ml-timestamp-shift offset unit it)))) (when it (org-ml-timestamp-shift offset unit it))))
subtree) subtree)))))
(org-ml-headline-map-contents* (org-x-logbook-config)
;; wrap in a section here because the matcher needs a single node
;; and not a list
(->> (apply #'org-ml-build-section it)
(org-ml-match-map* org-x--first-active-ts-pattern
(org-ml-timestamp-shift offset unit it))
(org-ml-get-children))
subtree)))
(shift (shift
(offset unit subtree) (offset unit subtree)
(->> (shift-timestamps offset unit subtree) (->> (shift-timestamps offset unit subtree)

View File

@ -677,6 +677,30 @@ Forms are denoted like %(FORM)%."
"CLOCK: [2021-04-18 Sun 13:02]--[2021-04-18 Sun 13:09] => 0:07" "CLOCK: [2021-04-18 Sun 13:02]--[2021-04-18 Sun 13:09] => 0:07"
":END:") ":END:")
"task (DONE)"
("* DONE headline"
"DEADLINE: <2020-01-01 Wed>"
":PROPERTIES:"
":CREATED: [2019-01-01 Tue]"
":END:"
":LOGGING:"
"- State \"DONE\" from \"TODO\" [2021-04-18 Sun 13:09]"
":END:"
":CLOCKING:"
"CLOCK: [2021-04-18 Sun 13:02]--[2021-04-18 Sun 13:09] => 0:07"
":END:")
=> (:result "* DONE headline"
"DEADLINE: <2020-01-01 Wed>"
":PROPERTIES:"
":CREATED: [2019-01-01 Tue]"
":END:"
":LOGGING:"
"- State \"DONE\" from \"TODO\" [2021-04-18 Sun 13:09]"
":END:"
":CLOCKING:"
"CLOCK: [2021-04-18 Sun 13:02]--[2021-04-18 Sun 13:09] => 0:07"
":END:")
"subtask" "subtask"
("* top" ("* top"
"** TODO headline" "** TODO headline"