Procházet zdrojové kódy

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.
Nicolas Goaziou před 12 roky
rodič
revize
31052f1c91
2 změnil soubory, kde provedl 5 přidání a 0 odebrání
  1. 2 0
      lisp/org.el
  2. 3 0
      testing/lisp/test-org.el

+ 2 - 0
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))))))

+ 3 - 0
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")