From eab41a756a6df529f0582ec0221dfde867bb0a07 Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Mon, 4 Jan 2010 15:11:31 +0100 Subject: [PATCH] TODO statistics: Handle entries without children Oscar Fuentes writes: > When a [/] is used on a header that does not contain subitems, pressing > C-c C-c on it signals an error on the minibuffer: > > org-update-statistics-cookies: No data for statistics cookie > > and the cookie appears with the same face (text color) as if it were > incomplete. > > IMHO, [/] on a header without subitems should show [0/0] with the same > face used for the case where all subitems are done. _______________________________________________ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode --- lisp/ChangeLog | 1 + lisp/org.el | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 5cd6219e4..e40e17761 100755 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -4,6 +4,7 @@ in link types. (org-open-file): When in-emacs is `system', also force system opening, like when the value was `(16)'. + (org-update-statistics-cookies): Handle entries without children. * org-exp.el (org-export-preprocess-before-normalizing-links-hook): New hook. diff --git a/lisp/org.el b/lisp/org.el index 9ce21cc55..75ddcd140 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -10310,7 +10310,12 @@ This should be called with the cursor in a line with a statistics cookie." (progn (goto-char end) (org-update-parent-todo-statistics)) - (error "No data for statistics cookie")))) + (goto-char pos) + (beginning-of-line 1) + (while (re-search-forward + "\\(\\(\\[[0-9]*%\\]\\)\\|\\(\\[[0-9]*/[0-9]*\\]\\)\\)" + (point-at-eol) t) + (replace-match (if (match-end 2) "[100%]" "[0/0]") t t))))) (goto-char pos) (move-marker pos nil))))) -- 2.11.4.GIT