>From 95cdfa8c3ec81b3a0763b68044611c10a4dadc29 Mon Sep 17 00:00:00 2001 From: Jay Kamat Date: Sat, 2 Sep 2017 15:57:36 -0400 Subject: [PATCH] org-archive.el: Update statistic cookies when archiving * lisp/org-archive.el (org-archive-subtree): Update todo statistics when calling `org-archive-subtree'. (org-archive-to-archive-sibling): Update cookie statistics when calling `org-archive-to-archive-sibling'. This can be disabled by setting `org-provide-todo-statistics' to nil. --- lisp/org-archive.el | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lisp/org-archive.el b/lisp/org-archive.el index adb922e75..9c24d356c 100644 --- a/lisp/org-archive.el +++ b/lisp/org-archive.el @@ -393,6 +393,12 @@ direct children of this heading." (when (featurep 'org-inlinetask) (org-inlinetask-remove-END-maybe)) (setq org-markers-to-move nil) + (when org-provide-todo-statistics + (save-excursion + ;; Go to parent, even if no children exist + (org-up-heading-safe) + ;; Update cookie of parent + (org-update-statistics-cookies nil))) (message "Subtree archived %s" (if (eq this-buffer buffer) (concat "under heading: " heading) @@ -470,6 +476,9 @@ Archiving time is retained in the ARCHIVE_TIME node property." (outline-hide-subtree) (org-cycle-show-empty-lines 'folded) (goto-char pos))) + (when org-provide-todo-statistics + ;; update todo statistics of parent + (org-update-parent-todo-statistics)) (org-reveal) (if (looking-at "^[ \t]*$") (outline-next-visible-heading 1)))) -- 2.11.0