summaryrefslogtreecommitdiff
path: root/lisp/thingatpt.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/thingatpt.el')
-rw-r--r--lisp/thingatpt.el5
1 files changed, 4 insertions, 1 deletions
diff --git a/lisp/thingatpt.el b/lisp/thingatpt.el
index 9920fa06d0c..df5c52d4d61 100644
--- a/lisp/thingatpt.el
+++ b/lisp/thingatpt.el
@@ -603,7 +603,10 @@ Signal an error if the entire string was not used."
;;;###autoload
(defun number-at-point ()
"Return the number at point, or nil if none is found."
- (form-at-point 'sexp 'numberp))
+ (when (thing-at-point-looking-at "-?[0-9]+\\.?[0-9]*" 500)
+ (string-to-number
+ (buffer-substring (match-beginning 0) (match-end 0)))))
+
(put 'number 'thing-at-point 'number-at-point)
;;;###autoload
(defun list-at-point ()