Parcourir la source

babel: number checking no longer fooled by strings ending in newlines

* contrib/babel/lisp/org-babel.el (org-babel-number-p): number
  checking is no longer fooled by strings ending in single newlines
Eric Schulte il y a 15 ans
Parent
commit
efbb07fe12
1 fichiers modifiés avec 3 ajouts et 1 suppressions
  1. 3 1
      contrib/babel/lisp/org-babel.el

+ 3 - 1
contrib/babel/lisp/org-babel.el

@@ -1289,7 +1289,9 @@ This is taken almost directly from `org-read-prop'."
 (defun org-babel-number-p (string)
   "Return t if STRING represents a number"
   (if (and (string-match "^-?[0-9]*\\.?[0-9]*$" string)
-           (= (match-end 0) (length string)))
+           (= (length (substring string (match-beginning 0)
+				 (match-end 0)))
+	      (length string)))
       (string-to-number string)))
 
 (defun org-babel-import-elisp-from-file (file-name)