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,15 +1105,9 @@ timestamp in the contents of the headline will be shifted."
(cl-labels
((shift-timestamps
(offset unit subtree)
(if (not (member (org-ml-get-property :todo-keyword subtree)
org-x-done-keywords))
(org-ml-headline-map-planning*
(-some->> it
(org-ml-map-property* :scheduled
(when it (org-ml-timestamp-shift offset unit it)))
(org-ml-map-property* :deadline
(when it (org-ml-timestamp-shift offset unit it))))
subtree)
(let ((kw (org-ml-get-property :todo-keyword subtree)))
(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
@ -1121,7 +1115,17 @@ timestamp in the contents of the headline will be shifted."
(org-ml-match-map* org-x--first-active-ts-pattern
(org-ml-timestamp-shift offset unit it))
(org-ml-get-children))
subtree)))
subtree))
((member kw org-x-done-keywords)
subtree)
(t
(org-ml-headline-map-planning*
(-some->> it
(org-ml-map-property* :scheduled
(when it (org-ml-timestamp-shift offset unit it)))
(org-ml-map-property* :deadline
(when it (org-ml-timestamp-shift offset unit it))))
subtree)))))
(shift
(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"
":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"
("* top"
"** TODO headline"