Prevent loss of `re-search-forward' results
* org.el (org-activate-links): `match-beginning' and `match-end` should be called shortly after `re-search-forward'. Otherwise, they may return values corresponding to a different invocation of `re-search-forward'. TINYCHANGE
This commit is contained in:
parent
55d3dfaaf8
commit
d07d8ff416
|
@ -5151,6 +5151,8 @@ This includes angle, plain, and bracket links."
|
||||||
(while (re-search-forward org-link-any-re limit t)
|
(while (re-search-forward org-link-any-re limit t)
|
||||||
(let* ((start (match-beginning 0))
|
(let* ((start (match-beginning 0))
|
||||||
(end (match-end 0))
|
(end (match-end 0))
|
||||||
|
(visible-start (or (match-beginning 4) (match-beginning 2)))
|
||||||
|
(visible-end (or (match-end 4) (match-end 2)))
|
||||||
(style (cond ((eq ?< (char-after start)) 'angle)
|
(style (cond ((eq ?< (char-after start)) 'angle)
|
||||||
((eq ?\[ (char-after (1+ start))) 'bracket)
|
((eq ?\[ (char-after (1+ start))) 'bracket)
|
||||||
(t 'plain))))
|
(t 'plain))))
|
||||||
|
@ -5200,9 +5202,7 @@ This includes angle, plain, and bracket links."
|
||||||
(append `(invisible
|
(append `(invisible
|
||||||
,(or (org-link-get-parameter type :display)
|
,(or (org-link-get-parameter type :display)
|
||||||
'org-link))
|
'org-link))
|
||||||
properties))
|
properties)))
|
||||||
(visible-start (or (match-beginning 3) (match-beginning 2)))
|
|
||||||
(visible-end (or (match-end 3) (match-end 2))))
|
|
||||||
(add-text-properties start visible-start hidden)
|
(add-text-properties start visible-start hidden)
|
||||||
(add-text-properties visible-start visible-end properties)
|
(add-text-properties visible-start visible-end properties)
|
||||||
(add-text-properties visible-end end hidden)
|
(add-text-properties visible-end end hidden)
|
||||||
|
|
Loading…
Reference in New Issue