Merge branch 'maint'

This commit is contained in:
Nicolas Goaziou 2017-04-15 17:28:04 +02:00
commit 0be422187f
2 changed files with 19 additions and 3 deletions

View File

@ -4365,6 +4365,10 @@ to an appropriate container (e.g., a paragraph)."
(if (memq 'table-cell restriction) (org-element-table-cell-parser) (if (memq 'table-cell restriction) (org-element-table-cell-parser)
(let* ((start (point)) (let* ((start (point))
(limit (limit
;; Object regexp sometimes needs to have a peek at
;; a character ahead. Therefore, when there is a hard
;; limit, make it one more than the true beginning of the
;; radio target.
(save-excursion (save-excursion
(cond ((not org-target-link-regexp) nil) (cond ((not org-target-link-regexp) nil)
((not (memq 'link restriction)) nil) ((not (memq 'link restriction)) nil)
@ -4380,8 +4384,8 @@ to an appropriate container (e.g., a paragraph)."
((and (= start (1+ (line-beginning-position))) ((and (= start (1+ (line-beginning-position)))
(= start (match-end 1))) (= start (match-end 1)))
(and (re-search-forward org-target-link-regexp nil t) (and (re-search-forward org-target-link-regexp nil t)
(match-beginning 1))) (1+ (match-beginning 1))))
(t (match-beginning 1))))) (t (1+ (match-beginning 1))))))
found) found)
(save-excursion (save-excursion
(while (and (not found) (while (and (not found)
@ -4453,7 +4457,8 @@ to an appropriate container (e.g., a paragraph)."
(org-element-link-parser))))))) (org-element-link-parser)))))))
(or (eobp) (forward-char)))) (or (eobp) (forward-char))))
(cond (found) (cond (found)
(limit (org-element-link-parser)) ;radio link (limit (forward-char -1)
(org-element-link-parser)) ;radio link
(t nil)))))) (t nil))))))
(defun org-element--parse-objects (beg end acc restriction &optional parent) (defun org-element--parse-objects (beg end acc restriction &optional parent)

View File

@ -1615,6 +1615,17 @@ e^{i\\pi}+1=0
(org-test-with-temp-text "* <<<a>>>\n<point>a-bug" (org-test-with-temp-text "* <<<a>>>\n<point>a-bug"
(org-update-radio-target-regexp) (org-update-radio-target-regexp)
(org-element-parse-buffer))) (org-element-parse-buffer)))
;; Pathological case: radio target in an emphasis environment.
(should
(eq 'bold
(org-test-with-temp-text "* <<<radio>>>\n<point>*radio*"
(org-update-radio-target-regexp)
(org-element-type (org-element-context)))))
(should
(eq 'link
(org-test-with-temp-text "* <<<radio>>>\n*<point>radio*"
(org-update-radio-target-regexp)
(org-element-type (org-element-context)))))
;; Standard link. ;; Standard link.
;; ;;
;; ... with description. ;; ... with description.