emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Orgmode] Re: checkbox statistics (fixed version)


From: Richard KLINDA
Subject: [Orgmode] Re: checkbox statistics (fixed version)
Date: Fri, 24 Apr 2009 15:01:32 +0200
User-agent: Gnus/5.110003 (No Gnus v0.3) XEmacs/21.4 (Instant Classic, linux)

This is the fixed patch, it actually works on my real life org files so
this has a slight chance of being right.

> ------------------------------------------------------------------------

diff --git a/lisp/org-list.el b/lisp/org-list.el
index 7469add..872dddf 100644
--- a/lisp/org-list.el
+++ b/lisp/org-list.el
@@ -110,6 +110,9 @@ with \\[org-ctrl-c-ctrl-c\\]."
   :group 'org-plain-lists
   :type 'boolean)
 
+(defcustom org-recursive-checkbox-statistics nil
+  "Non-nil means, that checkbox counting should happen recursively.")
+
 (defcustom org-description-max-indent 20
   "Maximum indentation for the second line of a description list.
 When the indentation would be larger than this, it will become
@@ -402,7 +405,10 @@ the whole buffer."
               (org-beginning-of-item)
               (setq curr-ind (org-get-indentation))
               (setq next-ind curr-ind)
-              (while (and (bolp) (org-at-item-p) (= curr-ind next-ind))
+                (while (and (bolp) (org-at-item-p)
+                            (if org-recursive-checkbox-statistics
+                                (<= curr-ind next-ind)
+                                (= curr-ind next-ind)))
                 (save-excursion (end-of-line) (setq eline (point)))
                 (if (re-search-forward re-box eline t)
                     (if (member (match-string 2) '("[ ]" "[-]"))
@@ -410,7 +416,12 @@ the whole buffer."
                       (setq c-on (1+ c-on))
                       )
                   )
-                (org-end-of-item)
+                  (if org-recursive-checkbox-statistics
+                      (progn
+                        (end-of-line)
+                        (when (re-search-forward org-list-beginning-re lim t)
+                          (beginning-of-line)))
+                      (org-end-of-item))
                 (setq next-ind (org-get-indentation))
                 )))
         (goto-char continue-from)

> ------------------------------------------------------------------------

-- 
Richard




reply via email to

[Prev in Thread] Current Thread [Next in Thread]