summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <n.goaziou@gmail.com>2012-12-04 23:50:26 +0100
committerNicolas Goaziou <n.goaziou@gmail.com>2012-12-04 23:50:26 +0100
commit31052f1c912e866b2e651721bc3145686512cc69 (patch)
tree641ee0688670063a6503e887769c8302a22c00e6
parent6c82226406ff65bafc1e0bc1fea8df0669f17898 (diff)
downloadorg-mode-31052f1c912e866b2e651721bc3145686512cc69.tar.gz
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.
-rw-r--r--lisp/org.el2
-rw-r--r--testing/lisp/test-org.el3
2 files changed, 5 insertions, 0 deletions
diff --git a/lisp/org.el b/lisp/org.el
index e3050b9..c4a006b 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 05ba889..443a253 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 "<<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")