Sfoglia il codice sorgente

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/
Bastien 4 anni fa
parent
commit
15a6836e4f
1 ha cambiato i file con 2 aggiunte e 1 eliminazioni
  1. 2 1
      lisp/ob-core.el

+ 2 - 1
lisp/ob-core.el

@@ -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))))