* lisp/org.el (org-all-targets): Fix radio targets detection when object is directly followed by a non-whitespace character. * testing/lisp/test-org.el: Add test.
@@ -5793,6 +5793,8 @@ targets."
(save-excursion
(goto-char (point-min))
(while (re-search-forward re nil t)
+ ;; Make sure point is really within the object.
+ (backward-char)
(let ((obj (org-element-context)))
(when (memq (org-element-type obj) '(radio-target target))
(add-to-list 'rtn (downcase (org-element-property :value obj))))))
@@ -878,6 +878,9 @@ Text.
(equal '("radio-target" "target")
(org-test-with-temp-text "<<target>> <<<radio-target>>>\n: <<verb>>"
(org-all-targets))))
+ (should
+ (equal '("radio-target")
+ (org-test-with-temp-text "<<<radio-target>>>!" (org-all-targets))))
;; With argument.
(should
(equal '("radio-target")