From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rasmus Subject: Re: [bug] TODO [/] cookie not updating if list has inline task Date: Sun, 17 May 2015 15:51:47 +0200 Message-ID: <87r3qfgvm4.fsf@gmx.us> References: <877fs75tzk.fsf@ucl.ac.uk> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:43753) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ytyz1-0003Qh-J5 for emacs-orgmode@gnu.org; Sun, 17 May 2015 09:52:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ytyyx-0003WP-Fn for emacs-orgmode@gnu.org; Sun, 17 May 2015 09:51:59 -0400 Received: from plane.gmane.org ([80.91.229.3]:54314) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ytyyx-0003VY-9D for emacs-orgmode@gnu.org; Sun, 17 May 2015 09:51:55 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1Ytyyv-0004la-Uh for emacs-orgmode@gnu.org; Sun, 17 May 2015 15:51:53 +0200 Received: from 71.red-88-19-189.staticip.rima-tde.net ([88.19.189.71]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 17 May 2015 15:51:53 +0200 Received: from rasmus by 71.red-88-19-189.staticip.rima-tde.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 17 May 2015 15:51:53 +0200 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Hi Eric, Eric S Fraga writes: > I often use checkbox lists for particular tasks. If any of the list > items has an inline task (whether a task or not), the updating of the > [/] cookie in the headline does not work. Attached is an example. > > Backtrace is also attached. Thanks. Can you try the attached patch? It seems to work on my system, but probably more cleanup should be made wrt the "old" outline-functions. —Rasmus -- This space is left intentionally blank --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0004-Fix-cookie-counter-bug.patch >From 965aa17b30fd511fbd2f4415104878c52c245550 Mon Sep 17 00:00:00 2001 From: Rasmus Date: Sun, 17 May 2015 15:48:40 +0200 Subject: [PATCH 4/4] Fix cookie counter bug * org.el (org-update-statistics-cookies): * org-list.el (org-update-checkbox-count): Do not use outline-next-heading. Reported-by: Eric S Fraga --- lisp/org-list.el | 12 ++++++++---- lisp/org.el | 8 ++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/lisp/org-list.el b/lisp/org-list.el index d18dff1..4950e05 100644 --- a/lisp/org-list.el +++ b/lisp/org-list.el @@ -2476,7 +2476,9 @@ With optional prefix argument ALL, do this for the whole buffer." (cons (point-min) (point-max)) (cons (or (ignore-errors (org-back-to-heading t) (point)) (point-min)) - (save-excursion (outline-next-heading) (point))))) + (org-with-wide-buffer + (org-next-visible-heading 1) + (point))))) (count-boxes (function ;; Return number of checked boxes and boxes of all types @@ -2534,15 +2536,17 @@ With optional prefix argument ALL, do this for the whole buffer." ;; in STRUCTS-BAK. This should only happen when ;; heading has more than one cookie on it. ((and (org-at-heading-p) - (<= (save-excursion (outline-next-heading) (point)) + (<= (org-with-wide-buffer (org-next-visible-heading 1) + (point)) backup-end)) (funcall count-boxes nil structs-bak recursivep)) ;; Cookie is at a fresh heading. Grab structure of ;; every list containing a checkbox between point and ;; next headline, and save them in STRUCTS-BAK. ((org-at-heading-p) - (setq backup-end (save-excursion - (outline-next-heading) (point)) + (setq backup-end (org-with-wide-buffer + (org-next-visible-heading 1) + (point)) structs-bak nil) (while (org-list-search-forward box-re backup-end 'move) (let* ((struct (org-list-struct)) diff --git a/lisp/org.el b/lisp/org.el index 0c3e61c..996b9d6 100755 --- a/lisp/org.el +++ b/lisp/org.el @@ -12867,10 +12867,10 @@ This should be called with the cursor in a line with a statistics cookie." (if (not (org-at-heading-p)) (org-update-checkbox-count) (setq l1 (org-outline-level)) - (setq end (save-excursion - (outline-next-heading) - (if (org-at-heading-p) (setq l2 (org-outline-level))) - (point))) + (setq end (org-with-wide-buffer + (org-next-visible-heading 1) + (if (org-at-heading-p) (setq l2 (org-outline-level))) + (point))) (if (and (save-excursion (re-search-forward "^[ \t]*\\([-+*]\\|[0-9]+[.)]\\) \\[[- X]\\]" end t)) -- 2.4.1 --=-=-=--