diff options
author | Max Mouratov <mmouratov@gmail.com> | 2019-08-29 22:48:22 +0500 |
---|---|---|
committer | Nicolas Goaziou <mail@nicolasgoaziou.fr> | 2019-09-16 18:55:04 +0200 |
commit | d07d8ff416373e5a4f2d91ed1d7f9cb3a80b8439 (patch) | |
tree | 8ee8bb8c4f8124b3289cda146c60830d61d987bd | |
parent | 55d3dfaaf8f915f6634208325f3ee5c76e3993b0 (diff) | |
download | org-mode-d07d8ff416373e5a4f2d91ed1d7f9cb3a80b8439.tar.gz |
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
-rw-r--r-- | lisp/org.el | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lisp/org.el b/lisp/org.el index f383f99..798a8b7 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -5151,6 +5151,8 @@ This includes angle, plain, and bracket links." (while (re-search-forward org-link-any-re limit t) (let* ((start (match-beginning 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) ((eq ?\[ (char-after (1+ start))) 'bracket) (t 'plain)))) @@ -5200,9 +5202,7 @@ This includes angle, plain, and bracket links." (append `(invisible ,(or (org-link-get-parameter type :display) 'org-link)) - properties)) - (visible-start (or (match-beginning 3) (match-beginning 2))) - (visible-end (or (match-end 3) (match-end 2)))) + properties))) (add-text-properties start visible-start hidden) (add-text-properties visible-start visible-end properties) (add-text-properties visible-end end hidden) |