mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-09-29 19:07:52 +00:00
ob-core.el: Fix `org-babel--string-to-number'
* lisp/ob-core.el (org-babel--string-to-number): Exclude strings not matching "^[0-9-e.+ ]+$" from being interpreted as numbers. Reported-by: Kaushal Modi <kaushal.modi@gmail.com> https://orgmode.org/list/CAFyQvY14iek+op12Vm7+jrniGEVU2yha7kuPtNtFQAso6d=PjQ@mail.gmail.com/
This commit is contained in:
parent
3e191242dc
commit
15a6836e4f
|
@ -2994,7 +2994,8 @@ situations in which is it not appropriate."
|
|||
(defun org-babel--string-to-number (string)
|
||||
"If STRING represents a number return its value.
|
||||
Otherwise return nil."
|
||||
(unless (string-match-p "\\s-" (org-trim string))
|
||||
(unless (or (string-match-p "\\s-" (org-trim string))
|
||||
(not (string-match-p "^[0-9-e.+ ]+$" string)))
|
||||
(let ((interned-string (ignore-errors (read string))))
|
||||
(when (numberp interned-string)
|
||||
interned-string))))
|
||||
|
|
Loading…
Reference in a new issue