From mboxrd@z Thu Jan 1 00:00:00 1970 From: Richard KLINDA Subject: Re: checkbox statistics (fixed version) Date: Fri, 24 Apr 2009 15:01:32 +0200 Message-ID: <8763gu8atv.fsf_-_@gmail.com> References: <87iqky8erm.fsf@gmail.com> <6B91D94A-35ED-493C-B11F-538EE0F78EFF@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LxL3R-0006ck-LM for emacs-orgmode@gnu.org; Fri, 24 Apr 2009 09:02:57 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LxL3L-0006b5-7u for emacs-orgmode@gnu.org; Fri, 24 Apr 2009 09:02:56 -0400 Received: from [199.232.76.173] (port=41546 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LxL3K-0006am-QC for emacs-orgmode@gnu.org; Fri, 24 Apr 2009 09:02:50 -0400 Received: from mx20.gnu.org ([199.232.41.8]:40822) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LxL3K-000416-8a for emacs-orgmode@gnu.org; Fri, 24 Apr 2009 09:02:50 -0400 Received: from viefep18-int.chello.at ([62.179.121.38]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LxL3J-0004kT-Fp for emacs-orgmode@gnu.org; Fri, 24 Apr 2009 09:02:49 -0400 Received: from edge02.upc.biz ([192.168.13.237]) by viefep18-int.chello.at (InterMail vM.7.09.01.00 201-2219-108-20080618) with ESMTP id <20090424130237.RBGH17051.viefep18-int.chello.at@edge02.upc.biz> for ; Fri, 24 Apr 2009 15:02:37 +0200 Received: from ignotus by localhost with local (masqmail 0.2.21) id 1LxL24-6Xk-00 for ; Fri, 24 Apr 2009 15:01:32 +0200 In-Reply-To: <6B91D94A-35ED-493C-B11F-538EE0F78EFF@gmail.com> (Carsten Dominik's message of "Tue, 21 Apr 2009 14:26:24 +0200") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org 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