From 1c1936fbb1f0c42e5c7e1d3c903626aa5993a357 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Tue, 25 Mar 2014 10:15:25 +0100 Subject: [PATCH] Allow radio links after an apostrophe and mid-word * lisp/org.el (org-make-target-link-regexp): Allow radio links after an apostrophe and mid-word. Small refactoring. * testing/lisp/test-ox.el (test-org-export/resolve-radio-link): Add test. See http://permalink.gmane.org/gmane.emacs.orgmode/84108. --- lisp/org.el | 18 +++++++----------- testing/lisp/test-ox.el | 9 +++++++++ 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index ef0bc3f24..a1b9b0bdf 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -6179,17 +6179,13 @@ targets." The regular expression finds the targets also if there is a line break between words." (and targets - (concat - "\\_<\\(" - (mapconcat - (lambda (x) - (setq x (regexp-quote x)) - (while (string-match " +" x) - (setq x (replace-match "\\s-+" t t x))) - x) - targets - "\\|") - "\\)\\_>"))) + (concat "\\(" + (mapconcat + (lambda (x) + (replace-regexp-in-string " +" "\\s-+" (regexp-quote x) t t)) + targets + "\\|") + "\\)"))) (defun org-activate-tags (limit) (if (re-search-forward (org-re "^\\*+.*[ \t]\\(:[[:alnum:]_@#%:]+:\\)[ \r\n]") limit t) diff --git a/testing/lisp/test-ox.el b/testing/lisp/test-ox.el index b0778ff8b..fe20496a1 100644 --- a/testing/lisp/test-ox.el +++ b/testing/lisp/test-ox.el @@ -2042,6 +2042,15 @@ Another text. (ref:text) (org-export-resolve-radio-link (org-element-map tree 'link 'identity info t) info)))) + ;; Radio link next to an apostrophe. + (should + (org-test-with-temp-text "<<>> radio's" + (org-update-radio-target-regexp) + (let* ((tree (org-element-parse-buffer)) + (info `(:parse-tree ,tree))) + (org-export-resolve-radio-link + (org-element-map tree 'link 'identity info t) + info)))) ;; Multiple radio targets. (should (equal '("radio1" "radio2") -- 2.11.4.GIT