org-link-plain-re: Improve regexp heuristics

* lisp/ol.el (org-link-make-regexps): Match <...> and <...> balanced
brackets.

This change detects plain links like
http://dx.doi.org/10.1002/(SICI)1521-396X(199901)171:1<239::AID-PSSA239>3.0.CO;2-M
This commit is contained in:
Ihor Radchenko 2024-02-03 15:15:46 +01:00
parent 5cb52f379b
commit 09ced6d2c2
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B
1 changed files with 4 additions and 4 deletions

View File

@ -853,12 +853,12 @@ This should be called after the variable `org-link-parameters' has changed."
org-link-plain-re
(let* ((non-space-bracket "[^][ \t\n()<>]")
(parenthesis
`(seq "("
`(seq (any "<([")
(0+ (or (regex ,non-space-bracket)
(seq "("
(seq (any "<([")
(0+ (regex ,non-space-bracket))
")")))
")")))
(any "])>"))))
(any "])>"))))
;; Heuristics for an URL link inspired by
;; https://daringfireball.net/2010/07/improved_regex_for_matching_urls
(rx-to-string