summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien <bzg@gnu.org>2021-05-15 22:03:47 +0200
committerBastien <bzg@gnu.org>2021-05-15 22:03:47 +0200
commite860fbf22a22dcbde83c6d131c17ff0b71be6991 (patch)
tree40d5f58ff8ec494322e7f3065439f9f151809d65
parent307e722dd9947aefd3c1e03452f5913bf9d68bfe (diff)
downloadorg-mode-e860fbf22a22dcbde83c6d131c17ff0b71be6991.tar.gz
lisp/org-list.el: Fix bug wrt updating statistics
* lisp/org-list.el (org-update-checkbox-count): Don't update statistics when toggling a checkbox witin a heading that has COOKIE_DATA set to "todo". Reported-by: Michael Brand <michael.ch.brand@gmail.com> Link: https://orgmode.org/list/CALn3zohYfoyDm6w-AYWsVRSbOCndBPZQyb+YvHcaEby3JEhWMw@mail.gmail.com
-rw-r--r--lisp/org-list.el7
1 files changed, 4 insertions, 3 deletions
diff --git a/lisp/org-list.el b/lisp/org-list.el
index 39122e7..3a31ae3 100644
--- a/lisp/org-list.el
+++ b/lisp/org-list.el
@@ -2484,10 +2484,10 @@ With optional prefix argument ALL, do this for the whole 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 "\\<recursive\\>"
- (or (org-entry-get nil "COOKIE_DATA") ""))))
+ (string-match-p "\\<recursive\\>" cookie-data)))
(within-inlinetask (and (not all)
(featurep 'org-inlinetask)
(org-inlinetask-in-task-p)))
@@ -2533,7 +2533,8 @@ With optional prefix argument ALL, do this for the whole buffer."
(while (re-search-forward cookie-re end t)
(let ((context (save-excursion (backward-char)
(save-match-data (org-element-context)))))
- (when (eq (org-element-type context) 'statistics-cookie)
+ (when (and (eq (org-element-type context) 'statistics-cookie)
+ (not (string-match-p "\\<todo\\>" cookie-data)))
(push
(append
(list (match-beginning 1) (match-end 1) (match-end 2))