org-babel-read: Avoid `save-match-data'

* lisp/ob-core.el (org-babel-read): Avoid fiddling with match data -
it is not used.
This commit is contained in:
Ihor Radchenko 2024-05-04 22:20:09 +03:00
parent 0227e12605
commit e09ad15a71
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B
1 changed files with 15 additions and 16 deletions

View File

@ -3361,22 +3361,21 @@ situations in which is it not appropriate."
;; FIXME: Arbitrary code evaluation.
(eval (read cell) t))
((let (read-val)
(save-match-data
(and (string-match
(rx bos (0+ (any space ?\n))
?\" (0+ anychar) ?\"
(0+ (any space ?\n)) eos)
cell)
;; CELL is a single string
(with-temp-buffer
(insert cell)
(goto-char 1)
(when (setq read-val
(ignore-errors
(read (current-buffer))))
(skip-chars-forward "[:space:]")
(eobp)))
read-val))))
(and (string-match-p
(rx bos (0+ (any space ?\n))
?\" (0+ anychar) ?\"
(0+ (any space ?\n)) eos)
cell)
;; CELL is a single string
(with-temp-buffer
(insert cell)
(goto-char 1)
(when (setq read-val
(ignore-errors
(read (current-buffer))))
(skip-chars-forward "[:space:]")
(eobp)))
read-val)))
(t (org-no-properties cell))))
(defun org-babel--string-to-number (string)