Pārlūkot izejas kodu

Statistics: Update more than one statistics cookie

When a line now contains several statistics cookies, all of them will
be updated.

Jari Aalto submitted a patch to this effect which I did end up not
using.  Thanks anyway!
Carsten Dominik 16 gadi atpakaļ
vecāks
revīzija
a79d36f2aa
3 mainītis faili ar 23 papildinājumiem un 18 dzēšanām
  1. 5 0
      lisp/ChangeLog
  2. 1 1
      lisp/org-list.el
  3. 17 17
      lisp/org.el

+ 5 - 0
lisp/ChangeLog

@@ -1,5 +1,10 @@
 2009-01-28  Carsten Dominik  <carsten.dominik@gmail.com>
 
+	* org-list.el (org-update-checkbox-count): Update more than one cookie.
+
+	* org.el (org-update-parent-todo-statistics): Update more than one
+	cookie.
+
 	* org-agenda.el (org-agenda-get-todos): Start search from correct
 	position.
 

+ 1 - 1
lisp/org-list.el

@@ -343,7 +343,7 @@ the whole buffer."
 	     end-cookie (match-end 1)
 	     cstat (+ cstat (if end-cookie 1 0))
 	     startsearch (point-at-eol)
-	     continue-from (point-at-bol)
+	     continue-from (match-beginning 0)
 	     is-percent (match-beginning 2)
 	     lim (cond
 		  ((org-on-heading-p) (outline-next-heading) (point))

+ 17 - 17
lisp/org.el

@@ -8569,24 +8569,24 @@ changes.  Such blocking occurs when:
     (catch 'exit
       (save-excursion
 	(setq level (org-up-heading-safe))
-	(unless (and level
-		     (re-search-forward box-re (point-at-eol) t))
+	(unless level
 	  (throw 'exit nil))
-	(setq is-percent (match-end 2))
-	(save-match-data
-	  (unless (outline-next-heading) (throw 'exit nil))
-	  (while (looking-at org-todo-line-regexp)
-	    (setq kwd (match-string 2))
-	    (and kwd (setq cnt-all (1+ cnt-all)))
-	    (and (member kwd org-done-keywords)
-		 (setq cnt-done (1+ cnt-done)))
-	    (condition-case nil
-		(org-forward-same-level 1)
-	      (error (end-of-line 1)))))
-	(replace-match
-	 (if is-percent
-	     (format "[%d%%]" (/ (* 100 cnt-done) (max 1 cnt-all)))
-	   (format "[%d/%d]" cnt-done cnt-all)))
+	(while (re-search-forward box-re (point-at-eol) t)
+	  (setq is-percent (match-end 2))
+	  (save-match-data
+	    (unless (outline-next-heading) (throw 'exit nil))
+	    (while (looking-at org-todo-line-regexp)
+	      (setq kwd (match-string 2))
+	      (and kwd (setq cnt-all (1+ cnt-all)))
+	      (and (member kwd org-done-keywords)
+		   (setq cnt-done (1+ cnt-done)))
+	      (condition-case nil
+		  (org-forward-same-level 1)
+		(error (end-of-line 1)))))
+	  (replace-match
+	   (if is-percent
+	       (format "[%d%%]" (/ (* 100 cnt-done) (max 1 cnt-all)))
+	     (format "[%d/%d]" cnt-done cnt-all))))
 	(run-hook-with-args 'org-after-todo-statistics-hook
 			    cnt-done (- cnt-all cnt-done))))))