forked from mirrors/org-mode
org-update-parent-todo-statistics: Use parser to match statistics cookie
* lisp/org.el (org-update-parent-todo-statistics): Ignore text matching statistics cookie that is inside verbatim environments or otherwise not detected by parser. Leave a single exception for headline properties for backwards compatibility.
This commit is contained in:
parent
522d7d0afe
commit
22050243b8
|
@ -9779,6 +9779,13 @@ statistics everywhere."
|
|||
(while (re-search-forward box-re (line-end-position) t)
|
||||
(setq cnt-all 0 cnt-done 0 cookie-present t)
|
||||
(setq is-percent (match-end 2) checkbox-beg (match-beginning 0))
|
||||
(when (org-element-type-p
|
||||
(save-excursion
|
||||
(goto-char checkbox-beg)
|
||||
(save-match-data (org-element-context)))
|
||||
'(statistics-cookie
|
||||
;; Special case - statistics cookie inside properties.
|
||||
keyword))
|
||||
(save-match-data
|
||||
(unless (outline-next-heading) (throw 'exit nil))
|
||||
(while (and (looking-at org-complex-heading-regexp)
|
||||
|
@ -9821,7 +9828,7 @@ statistics everywhere."
|
|||
(goto-char checkbox-beg)
|
||||
(insert new)
|
||||
(delete-region (point) (+ (point) ndel))
|
||||
(when org-auto-align-tags (org-fix-tags-on-the-fly)))
|
||||
(when org-auto-align-tags (org-fix-tags-on-the-fly))))
|
||||
(when cookie-present
|
||||
(run-hook-with-args 'org-after-todo-statistics-hook
|
||||
cnt-done (- cnt-all cnt-done))))))
|
||||
|
|
Loading…
Reference in New Issue