Fix equality check for default task when continuing the clock

The markers involved in this check might point to the same heading, but on different positions.  Try
to mitigate this by checking for equality of the ID property.
This commit is contained in:
Daniel Borchmann 2025-07-19 15:20:45 +02:00
parent 914609074b
commit 64198261f7
No known key found for this signature in database
GPG Key ID: 50EA937BF472ADD1

View File

@ -518,11 +518,13 @@ user for the next task to clock into."
((and (markerp org-clock-interrupted-task) ((and (markerp org-clock-interrupted-task)
(marker-buffer org-clock-interrupted-task) (marker-buffer org-clock-interrupted-task)
;; Ensure that interrupted task is not the default task; in this case, we prefer to ;; Ensure that interrupted task is not the default task; in this case, we prefer to
;; continue with parent tasks instead. ;; continue with parent tasks instead. We check equality of tasks by comparing
;; their ID properties, to avoid comparing misplaced marker that actually point to
;; the same heading.
(or (not (markerp org-clock-default-task)) (or (not (markerp org-clock-default-task))
(not (marker-buffer org-clock-default-task)) (not (marker-buffer org-clock-default-task))
(not (= org-clock-interrupted-task (not (string= (org-with-point-at org-clock-interrupted-task (org-id-get-create))
org-clock-default-task))) (org-with-point-at org-clock-default-task (org-id-get-create)))))
(org-with-point-at org-clock-interrupted-task (org-with-point-at org-clock-interrupted-task
(not (member (nth 2 (org-heading-components)) (not (member (nth 2 (org-heading-components))
org-done-keywords)))) org-done-keywords))))