Hi Eric, Eric S Fraga <e.fr...@ucl.ac.uk> 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
>From 965aa17b30fd511fbd2f4415104878c52c245550 Mon Sep 17 00:00:00 2001 From: Rasmus <ras...@gmx.us> 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 <e.fr...@ucl.ac.uk> <http://permalink.gmane.org/gmane.emacs.orgmode/97594> --- 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