From 5ff5ac03b6e93a6cd84f99e65649f09c03e95d36 Mon Sep 17 00:00:00 2001 From: Ihor Radchenko Date: Fri, 25 Aug 2023 14:12:31 +0300 Subject: [PATCH] * lisp/ox.el (org-export-parse-include-value): Remove `save-match-data' Avoid using GC-expensive `save-match-data'. --- lisp/ox.el | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/lisp/ox.el b/lisp/ox.el index 5926baf15..1e7443be1 100644 --- a/lisp/ox.el +++ b/lisp/ox.el @@ -3463,20 +3463,17 @@ provided as the :unmatched parameter." (setq value (replace-match "" nil nil value))))) (file (and (string-match "^\\(\".+?\"\\|\\S-+\\)\\(?:\\s-+\\|$\\)" value) - (prog1 - (save-match-data - (let ((matched (match-string 1 value)) - stripped) - (when (string-match "\\(::\\(.*?\\)\\)\"?\\'" - matched) - (setq location (match-string 2 matched)) - (setq matched - (replace-match "" nil nil matched 1))) - (setq stripped (org-strip-quotes matched)) - (if (org-url-p stripped) - stripped - (expand-file-name stripped dir)))) - (setq value (replace-match "" nil nil value))))) + (let ((matched (match-string 1 value)) stripped) + (setq value (replace-match "" nil nil value)) + (when (string-match "\\(::\\(.*?\\)\\)\"?\\'" + matched) + (setq location (match-string 2 matched)) + (setq matched + (replace-match "" nil nil matched 1))) + (setq stripped (org-strip-quotes matched)) + (if (org-url-p stripped) + stripped + (expand-file-name stripped dir))))) (only-contents (and (string-match ":only-contents *\\([^: \r\t\n]\\S-*\\)?" value)