瀏覽代碼

Don't overlook checkboxes in ordered lists when updating statistics cookie

Manish writes:

> I noticed a small inconsistency.  If you start with following sample
> org file and press C-c C-c in the first cookie, it doesn't get updated
> correctly whereas the second one does.  The only difference is that
> one has children TODO tasks and the other has a list of checkboxes.
>
> Starting file:
>
> --8<---------------cut here---------------start------------->8---
> * Item 1 [/]
>  1. [X] line 1
>  2. [ ] line 2
> * Item 2 [/]
> *** TODO Sub-item 2.1
> *** DONE Sub-item 2.2
> --8<---------------cut here---------------end--------------->8---
>
> Status after C-c C-c in the summary cookie.
>
> --8<---------------cut here---------------start------------->8---
> * Item 1 [0/0]
>  1. [X] line 1
>  2. [ ] line 2
> * Item 2 [1/2]
> *** TODO Sub-item 2.1
> *** DONE Sub-item 2.2
> --8<---------------cut here---------------end--------------->8---
Carsten Dominik 15 年之前
父節點
當前提交
f9eb4ee98c
共有 2 個文件被更改,包括 8 次插入2 次删除
  1. 5 0
      lisp/ChangeLog
  2. 3 2
      lisp/org.el

+ 5 - 0
lisp/ChangeLog

@@ -1,3 +1,8 @@
+2010-01-08  Carsten Dominik  <carsten.dominik@gmail.com>
+
+	* org.el (org-update-statistics-cookies): Also see checkboxes in
+	ordered lists.
+
 2010-01-07  Carsten Dominik  <carsten.dominik@gmail.com>
 
 	* org-agenda.el (org-agenda-view-mode-dispatch): Define the `L'

+ 3 - 2
lisp/org.el

@@ -10302,8 +10302,9 @@ This should be called with the cursor in a line with a statistics cookie."
 		      (outline-next-heading)
 		      (if (org-on-heading-p) (setq l2 (org-outline-level)))
 		      (point)))
-	  (if (and (save-excursion (re-search-forward
-				    "^[ \t]*[-+*] \\[[- X]\\]" end t))
+	  (if (and (save-excursion
+		     (re-search-forward
+		      "^[ \t]*\\([-+*]\\|[0-9]+[.)]\\) \\[[- X]\\]" end t))
 		   (not (save-excursion (re-search-forward
 					 ":COOKIE_DATA:.*\\<todo\\>" end t))))
 	      (org-update-checkbox-count)