branch: externals/org
commit 0efcbc617cd8e7a284fada9eaf03716d1d4c2f51
Author: Ihor Radchenko <[email protected]>
Commit: Ihor Radchenko <[email protected]>

    org-update-checkbox-count: Honor COOKIE_DATA for individual headings
    
    * lisp/org-list.el (org-update-checkbox-count): Do not use COOKIE_DATA
    value at point to judge whether a cookie is recursive or not.  We need
    to honor COOKIE_DATA in the heading the cookie is actually located,
    not the heading that happens to be at point when the function is
    called, especially with ALL argument.
    
    Reported-by: Jacob S. Gordon <[email protected]>
    Link: 
https://orgmode.org/list/[email protected]
---
 lisp/org-list.el | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/lisp/org-list.el b/lisp/org-list.el
index 9b33944026..5395140e85 100644
--- a/lisp/org-list.el
+++ b/lisp/org-list.el
@@ -2546,10 +2546,6 @@ portion of the buffer."
       (let* ((cookie-re 
"\\(\\(\\[[0-9]*%\\]\\)\\|\\(\\[[0-9]*/[0-9]*\\]\\)\\)")
             (box-re "^[ \t]*\\([-+*]\\|\\([0-9]+\\|[A-Za-z]\\)[.)]\\)[ \t]+\
 \\(?:\\[@\\(?:start:\\)?\\([0-9]+\\|[A-Za-z]\\)\\][ \t]*\\)?\\(\\[[- X]\\]\\)")
-             (cookie-data (or (org-entry-get nil "COOKIE_DATA") ""))
-            (recursivep
-             (or (not org-checkbox-hierarchical-statistics)
-                 (string-match-p "\\<recursive\\>" cookie-data)))
             (within-inlinetask (and (not all)
                                     (featurep 'org-inlinetask)
                                     (org-inlinetask-in-task-p)))
@@ -2593,8 +2589,12 @@ portion of the buffer."
         ;; cookie, number of checked boxes to report and total number of
         ;; boxes.
         (while (re-search-forward cookie-re end t)
-          (let ((context (save-excursion (backward-char)
-                                        (save-match-data 
(org-element-context)))))
+          (let* ((context (save-excursion (backward-char)
+                                         (save-match-data 
(org-element-context))))
+                 (cookie-data (save-match-data (or (org-entry-get nil 
"COOKIE_DATA") "")))
+                (recursivep
+                 (or (not org-checkbox-hierarchical-statistics)
+                     (string-match-p "\\<recursive\\>" cookie-data))))
            (when (and (org-element-type-p context 'statistics-cookie)
                        (not (string-match-p "\\<todo\\>" cookie-data)))
              (push

Reply via email to