From 84f9d81abceb8e260892bd8bd132b2e0a399e9c4 Mon Sep 17 00:00:00 2001 From: Ihor Radchenko Date: Mon, 17 Jun 2024 17:21:01 +0200 Subject: [PATCH] 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 Link: https://orgmode.org/list/878qz49an7.fsf@gmail.com --- lisp/org-list.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lisp/org-list.el b/lisp/org-list.el index 45a07a715..564bc31bc 100644 --- a/lisp/org-list.el +++ b/lisp/org-list.el @@ -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