Fix cookies update with recursive COOKIE_DATA property

* lisp/org.el (org-update-parent-todo-statistics): COOKIE_DATA should
  be checked for parent, not current headline. Also, this function
  doesn't need to be interactive.
This commit is contained in:
Nicolas Goaziou 2011-07-18 02:18:46 +02:00
parent f7f2394448
commit d243679491
1 changed files with 8 additions and 16 deletions

View File

@ -11306,16 +11306,12 @@ This should be called with the cursor in a line with a statistics cookie."
When `org-hierarchical-todo-statistics' is nil, statistics will cover When `org-hierarchical-todo-statistics' is nil, statistics will cover
the entire subtree and this will travel up the hierarchy and update the entire subtree and this will travel up the hierarchy and update
statistics everywhere." statistics everywhere."
(interactive) (let* ((prop (save-excursion (org-up-heading-safe)
(let* ((lim 0) prop (org-entry-get nil "COOKIE_DATA" 'inherit)))
(recursive (or (not org-hierarchical-todo-statistics) (recursive (or (not org-hierarchical-todo-statistics)
(string-match (and prop (string-match "\\<recursive\\>" prop))))
"\\<recursive\\>" (lim (or (and prop (marker-position org-entry-property-inherited-from))
(or (setq prop (org-entry-get 0))
nil "COOKIE_DATA" 'inherit)) ""))))
(lim (or (and prop (marker-position
org-entry-property-inherited-from))
lim))
(first t) (first t)
(box-re "\\(\\(\\[[0-9]*%\\]\\)\\|\\(\\[[0-9]*/[0-9]*\\]\\)\\)") (box-re "\\(\\(\\[[0-9]*%\\]\\)\\|\\(\\[[0-9]*/[0-9]*\\]\\)\\)")
level ltoggle l1 new ndel level ltoggle l1 new ndel
@ -11324,9 +11320,7 @@ statistics everywhere."
(catch 'exit (catch 'exit
(save-excursion (save-excursion
(beginning-of-line 1) (beginning-of-line 1)
(if (org-at-heading-p) (setq ltoggle (funcall outline-level))
(setq ltoggle (funcall outline-level))
(error "This should not happen"))
(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))
@ -11334,10 +11328,8 @@ statistics everywhere."
(unless (and level (unless (and level
(not (string-match (not (string-match
"\\<checkbox\\>" "\\<checkbox\\>"
(downcase (downcase (or (org-entry-get nil "COOKIE_DATA")
(or (org-entry-get "")))))
nil "COOKIE_DATA")
"")))))
(throw 'exit nil)) (throw 'exit nil))
(while (re-search-forward box-re (point-at-eol) t) (while (re-search-forward box-re (point-at-eol) t)
(setq cnt-all 0 cnt-done 0 cookie-present t) (setq cnt-all 0 cnt-done 0 cookie-present t)