Another try to the fix org-ql link regexp generator

The previous version caused stack overflows in the regexp matcher, supposedly
because of matching newlines in the description.  This should not happend
anymore, but description won't be matched anymore of they contain a line break.
This commit is contained in:
Daniel - 2022-06-09 21:20:55 +02:00
parent 949b49226d
commit 72c67796c2
No known key found for this signature in database
GPG Key ID: 784AA8DF0CCDF625
1 changed files with 6 additions and 7 deletions

13
init.el
View File

@ -974,23 +974,22 @@ respectively."
(description target)
(rx-to-string `(seq (or bol (1+ blank))
"[[" (0+ (not (any "]"))) (regexp ,target) (0+ (not (any "]")))
;; Added `anything'
"][" (0+ anything) (regexp ,description) (0+ anything)
;; Added .* wildcards
"][" (regexp ".*") (regexp ,description) (regexp ".*")
"]]")))
;; Note that these actually allow empty descriptions
;; or targets, depending on what they are matching.
(match-desc
(match) (rx-to-string `(seq (or bol (1+ blank))
"[[" (0+ (not (any "]")))
;; Added `anything'
"][" (0+ anything) (regexp ,match) (0+ anything)
;; Added .* wildcards
"][" (regexp ".*") (regexp ,match) (regexp ".*")
"]]")))
(match-target
(match) (rx-to-string `(seq (or bol (1+ blank))
"[[" (0+ (not (any "]"))) (regexp ,match) (0+ (not (any "]")))
;; Added `anything'
"][" (0+ anything)
"]]"))))
;; Removed pattern for description
"][" ))))
(cond (description-or-target
(rx-to-string `(or (regexp ,(no-desc description-or-target))
(regexp ,(match-desc description-or-target))