From ab2bb3715212da03682119efa4a5e3e7d5ac84c5 Mon Sep 17 00:00:00 2001 From: ndwarshuis Date: Sun, 6 Feb 2022 20:42:52 -0500 Subject: [PATCH] FIX assign new ids in nested iterator projects --- local/lib/org-x/org-x.el | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/local/lib/org-x/org-x.el b/local/lib/org-x/org-x.el index 0af42d1..372ab3a 100644 --- a/local/lib/org-x/org-x.el +++ b/local/lib/org-x/org-x.el @@ -2135,10 +2135,18 @@ timestamp in the contents of the headline will be shifted." (defun org-x--subtree-repeat-shifted (n offset unit headline) "Return HEADLINE repeated and shifted by OFFSET UNITs N times." - (->> (org-ml-clone-node-n n headline) - (--map-indexed (org-x--subtree-shift-timestamps - (* offset (1+ it-index)) unit it)) - (--map (org-ml-headline-set-node-property "ID" (org-id-new) it)))) + (cl-labels + ((assign-id + (hl) + (->> (org-ml-headline-set-node-property "ID" (org-id-new) hl) + (org-ml-headline-map-subheadlines* + (--map-when (org-ml-get-property :todo-keyword it) + (assign-id it) + it))))) + (->> (org-ml-clone-node-n n headline) + (--map-indexed (org-x--subtree-shift-timestamps + (* offset (1+ it-index)) unit it)) + (-map #'assign-id)))) (defun org-x-clone-subtree-with-time-shift (n) "Like `org-clone-subtree-with-time-shift' except reset items and todos.