org-find-open-clocks: Fix false positives

* lisp/org-clock.el (org-find-open-clocks): Ensure that we only match
actual clock elements, not everything matching `org-clock-re',
including clocks inside verbatim environments.
This commit is contained in:
Ihor Radchenko 2023-06-09 11:30:37 +03:00
parent 759676b308
commit f2dd1eea41
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B
1 changed files with 4 additions and 3 deletions

View File

@ -921,9 +921,10 @@ If CLOCK-SOUND is non-nil, it overrides `org-clock-sound'."
(save-excursion
(goto-char (point-min))
(while (re-search-forward org-clock-re nil t)
(push (cons (copy-marker (match-end 1) t)
(org-time-string-to-time (match-string 1)))
clocks))))
(when (org-element-type-p (org-element-at-point) 'clock)
(push (cons (copy-marker (match-end 1) t)
(org-time-string-to-time (match-string 1)))
clocks)))))
clocks))
(defsubst org-is-active-clock (clock)