ox: Fix parsing of example #+includes

* lisp/ox.el (org-export-parse-include-value): Since the example
environment regexp does not contain a capture group, we can not assume
we can call `replace-match' on the first capture group.  Before doing
so, check that the capture group indeed exists.
This commit is contained in:
TEC 2023-01-23 01:09:34 +08:00 committed by Ihor Radchenko
parent ce4f7db3c1
commit a9ee43a124
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B
1 changed files with 2 additions and 1 deletions

View File

@ -3420,7 +3420,8 @@ provided as the :unmatched parameter."
:org-include-induced-level))))
(args (and (eq env 'literal)
(prog1 (match-string 1 value)
(setq value (replace-match "" nil nil value 1)))))
(when (match-string 1 value)
(setq value (replace-match "" nil nil value 1))))))
(block (and (or (string-match "\"\\(\\S-+\\)\"" value)
(string-match "\\<\\(\\S-+\\)\\>" value))
(or (= (match-beginning 0) 0)