Fix TODO statistics bug
Alessandro Paccacio writes: > I've an outline like this: > > * Project A > ** TODO Task A-1 [0/3] > *** TODO Subtask A-1-a > *** TODO Subtask A-1-b > *** TODO Subtask A-1-c > > where level 1 heading is the name of a project, level 2 heading is a > generic task broken into three level 3 headings. As suggested in > section 5.5 of the manual, I've hooked the org-summary-todo function > to org-after-todo-statistics-hook, in order to automatically change > the level 2 TODO to DONE when all the subtasks are DONE. > Unfortunately, when I change to DONE the first subtask, an unexpected > TODO is added to level 1 heading: > > * TODO Project A > ** TODO Task A-1 [1/3] > *** DONE Subtask A-1-a > *** TODO Subtask A-1-b > *** TODO Subtask A-1-c > > From now on, the switch TODO->DONE or DONE/TODO applies to level 1 > heading, even if the [/] cookie in level 2 is correctly updated: > > * DONE Project A > ** TODO Task A-1 [3/3] > *** DONE Subtask A-1-a > *** DONE Subtask A-1-b > *** DONE Subtask A-1-c > > Is there a way to apply the automatic change of TODO to the parent > heading only, as below? > > * Project A > ** DONE Task A-1 [3/3] > *** DONE Subtask A-1-a > *** DONE Subtask A-1-b > *** DONE Subtask A-1-c
This commit is contained in:
parent
fce076d3cb
commit
e946c7d239
|
@ -3,6 +3,8 @@
|
||||||
* org.el (org-refile): Refile to clock only if the prefix arg is
|
* org.el (org-refile): Refile to clock only if the prefix arg is
|
||||||
2.
|
2.
|
||||||
(org-sparse-tree): Fix docstring to be in line with prompt.
|
(org-sparse-tree): Fix docstring to be in line with prompt.
|
||||||
|
(org-update-parent-todo-statistics): Call
|
||||||
|
`org-after-todo-statistics-hook' on each level.
|
||||||
|
|
||||||
2009-11-04 Carsten Dominik <carsten.dominik@gmail.com>
|
2009-11-04 Carsten Dominik <carsten.dominik@gmail.com>
|
||||||
|
|
||||||
|
|
|
@ -9973,7 +9973,7 @@ statistics everywhere."
|
||||||
(while (and (setq level (org-up-heading-safe))
|
(while (and (setq level (org-up-heading-safe))
|
||||||
(or recursive first)
|
(or recursive first)
|
||||||
(>= (point) lim))
|
(>= (point) lim))
|
||||||
(setq first nil)
|
(setq first nil cookie-present nil)
|
||||||
(unless (and level
|
(unless (and level
|
||||||
(not (string-match
|
(not (string-match
|
||||||
"\\<checkbox\\>"
|
"\\<checkbox\\>"
|
||||||
|
@ -10008,10 +10008,10 @@ statistics everywhere."
|
||||||
ndel (- (match-end 0) (match-beginning 0)))
|
ndel (- (match-end 0) (match-beginning 0)))
|
||||||
(goto-char (match-beginning 0))
|
(goto-char (match-beginning 0))
|
||||||
(insert new)
|
(insert new)
|
||||||
(delete-region (point) (+ (point) ndel))))
|
(delete-region (point) (+ (point) ndel)))
|
||||||
(when cookie-present
|
(when cookie-present
|
||||||
(run-hook-with-args 'org-after-todo-statistics-hook
|
(run-hook-with-args 'org-after-todo-statistics-hook
|
||||||
cnt-done (- cnt-all cnt-done)))))
|
cnt-done (- cnt-all cnt-done))))))
|
||||||
(run-hooks 'org-todo-statistics-hook)))
|
(run-hooks 'org-todo-statistics-hook)))
|
||||||
|
|
||||||
(defvar org-after-todo-statistics-hook nil
|
(defvar org-after-todo-statistics-hook nil
|
||||||
|
|
Loading…
Reference in New Issue