org-update-checkbox-count: Do not move point beyond current heading

* lisp/org-list.el (org-update-checkbox-count): Do not move point
before current heading when point is already on heading.

Reported-by: Bruno Cardoso <cardoso.bc@gmail.com>
Link: https://orgmode.org/list/878qz49an7.fsf@gmail.com
This commit is contained in:
Ihor Radchenko 2024-06-17 17:21:01 +02:00
parent b7b188e233
commit 84f9d81abc
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B
1 changed files with 2 additions and 1 deletions

View File

@ -106,6 +106,7 @@
(declare-function org-at-heading-p "org" (&optional invisible-ok))
(declare-function org-back-to-heading "org" (&optional invisible-ok))
(declare-function org-back-to-heading-or-point-min "org" (&optional invisible-ok))
(declare-function org-before-first-heading-p "org" ())
(declare-function org-current-level "org" ())
(declare-function org-element-at-point "org-element" (&optional pom cached-only))
@ -2582,7 +2583,7 @@ portion of the buffer."
;; Move to start.
(cond (all (goto-char (point-min)))
(within-inlinetask (org-back-to-heading t))
(t (org-with-limited-levels (outline-previous-heading))))
(t (org-with-limited-levels (org-back-to-heading-or-point-min t))))
;; Build an alist for each cookie found. The key is the position
;; at beginning of cookie and values ending position, format of
;; cookie, number of checked boxes to report and total number of