summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <n.goaziou@gmail.com>2011-07-18 02:18:46 +0200
committerNicolas Goaziou <n.goaziou@gmail.com>2011-07-18 02:20:00 +0200
commitd243679491c16e85fd75e305483f02567fabb544 (patch)
tree216a94f90b4c5b0e660414f485bad7e88751f12a
parentf7f2394448b033906a2699ed61f8cac855296fa7 (diff)
downloadorg-mode-d243679491c16e85fd75e305483f02567fabb544.tar.gz
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.
-rw-r--r--lisp/org.el24
1 files changed, 8 insertions, 16 deletions
diff --git a/lisp/org.el b/lisp/org.el
index 8c10534..a1bb1cc 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -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
the entire subtree and this will travel up the hierarchy and update
statistics everywhere."
- (interactive)
- (let* ((lim 0) prop
+ (let* ((prop (save-excursion (org-up-heading-safe)
+ (org-entry-get nil "COOKIE_DATA" 'inherit)))
(recursive (or (not org-hierarchical-todo-statistics)
- (string-match
- "\\<recursive\\>"
- (or (setq prop (org-entry-get
- nil "COOKIE_DATA" 'inherit)) ""))))
- (lim (or (and prop (marker-position
- org-entry-property-inherited-from))
- lim))
+ (and prop (string-match "\\<recursive\\>" prop))))
+ (lim (or (and prop (marker-position org-entry-property-inherited-from))
+ 0))
(first t)
(box-re "\\(\\(\\[[0-9]*%\\]\\)\\|\\(\\[[0-9]*/[0-9]*\\]\\)\\)")
level ltoggle l1 new ndel
@@ -11324,9 +11320,7 @@ statistics everywhere."
(catch 'exit
(save-excursion
(beginning-of-line 1)
- (if (org-at-heading-p)
- (setq ltoggle (funcall outline-level))
- (error "This should not happen"))
+ (setq ltoggle (funcall outline-level))
(while (and (setq level (org-up-heading-safe))
(or recursive first)
(>= (point) lim))
@@ -11334,10 +11328,8 @@ statistics everywhere."
(unless (and level
(not (string-match
"\\<checkbox\\>"
- (downcase
- (or (org-entry-get
- nil "COOKIE_DATA")
- "")))))
+ (downcase (or (org-entry-get nil "COOKIE_DATA")
+ "")))))
(throw 'exit nil))
(while (re-search-forward box-re (point-at-eol) t)
(setq cnt-all 0 cnt-done 0 cookie-present t)