diff options
author | Carsten Dominik <carsten.dominik@gmail.com> | 2010-01-04 15:11:31 +0100 |
---|---|---|
committer | Carsten Dominik <carsten.dominik@gmail.com> | 2010-01-04 15:11:31 +0100 |
commit | eab41a756a6df529f0582ec0221dfde867bb0a07 (patch) | |
tree | 62a950a7e12178da98d13ec3c07c8c380ba3e1de | |
parent | 3e0c61d86cc0e47c0369212fd0416e4cadc81165 (diff) | |
download | org-mode-eab41a756a6df529f0582ec0221dfde867bb0a07.tar.gz |
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
-rwxr-xr-x | lisp/ChangeLog | 1 | ||||
-rw-r--r-- | lisp/org.el | 7 |
2 files changed, 7 insertions, 1 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 5cd6219..e40e177 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 9ce21cc..75ddcd1 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))))) |