From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: Re: checkbox statistics (fixed version) Date: Fri, 8 May 2009 17:27:50 +0200 Message-ID: <79AB1A11-3CDC-4532-AFAC-8E466F5146C9@gmail.com> References: <87iqky8erm.fsf@gmail.com> <6B91D94A-35ED-493C-B11F-538EE0F78EFF@gmail.com> <8763gu8atv.fsf_-_@gmail.com> Mime-Version: 1.0 (Apple Message framework v930.3) Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1M2Sli-0007L0-8a for emacs-orgmode@gnu.org; Fri, 08 May 2009 12:17:50 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1M2Slc-0007Jo-O5 for emacs-orgmode@gnu.org; Fri, 08 May 2009 12:17:48 -0400 Received: from [199.232.76.173] (port=39313 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1M2Slc-0007Jf-Ac for emacs-orgmode@gnu.org; Fri, 08 May 2009 12:17:44 -0400 Received: from mail-ew0-f162.google.com ([209.85.219.162]:53271) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1M2Slb-0001L5-Ga for emacs-orgmode@gnu.org; Fri, 08 May 2009 12:17:44 -0400 Received: by ewy6 with SMTP id 6so2047917ewy.42 for ; Fri, 08 May 2009 09:17:42 -0700 (PDT) In-Reply-To: <8763gu8atv.fsf_-_@gmail.com> 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: Richard KLINDA Cc: emacs-orgmode@gnu.org Hi Richard, your patch works, almost. Where it goes wrong is here: * test [3/6] - one - [X] two - three - [-] four - [X] five - [-] six - seven - [ ] eight - [X] nine The statistics cookie talks about 6 checkboxes below it, but in fact there are only 4, two (at "four" and "six") are a "summary" checkboxes. So we get the funny effect that toggling "eight" will make the cookie jump from 3/6 directly to 6/6 .... Maybe this is acceptable, because the "summary" checkboxes don't really make sense when the statistics covers the entire tree.... Opinions? - Carsten On Apr 24, 2009, at 3:01 PM, Richard KLINDA wrote: > 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 > > > _______________________________________________ > Emacs-orgmode mailing list > Remember: use `Reply All' to send replies to the list. > Emacs-orgmode@gnu.org > http://lists.gnu.org/mailman/listinfo/emacs-orgmode