From 31052f1c912e866b2e651721bc3145686512cc69 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Tue, 4 Dec 2012 23:50:26 +0100 Subject: [PATCH] Fix radio targets detection * 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. --- lisp/org.el | 2 ++ testing/lisp/test-org.el | 3 +++ 2 files changed, 5 insertions(+) diff --git a/lisp/org.el b/lisp/org.el index e3050b90c..c4a006ba3 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -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)))))) diff --git a/testing/lisp/test-org.el b/testing/lisp/test-org.el index 05ba88974..443a253ad 100644 --- a/testing/lisp/test-org.el +++ b/testing/lisp/test-org.el @@ -878,6 +878,9 @@ Text. (equal '("radio-target" "target") (org-test-with-temp-text "<> <<>>\n: <>" (org-all-targets)))) + (should + (equal '("radio-target") + (org-test-with-temp-text "<<>>!" (org-all-targets)))) ;; With argument. (should (equal '("radio-target") -- 2.11.4.GIT