emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] scratch/backports-25.2 51656da 28/46: Fix number-at-point


From: Noam Postavsky
Subject: [Emacs-diffs] scratch/backports-25.2 51656da 28/46: Fix number-at-point in lisp buffers
Date: Sun, 2 Oct 2016 14:04:49 +0000 (UTC)

branch: scratch/backports-25.2
commit 51656dadaa28917e578bbcb2e2373ed6212418e9
Author: Nicolas Richard <address@hidden>
Commit: Noam Postavsky <address@hidden>

    Fix number-at-point in lisp buffers
    
    * lisp/thingatpt.el (number-at-point): Don't say that things
    like ?a are numbers in lisp mode buffers (bug#8634).
    
    (cherry picked from commit 786ab4a5ca0a326a1c2d44dcbfed8427f7783062)
---
 lisp/thingatpt.el |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lisp/thingatpt.el b/lisp/thingatpt.el
index 9920fa0..df5c52d 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 ()



reply via email to

[Prev in Thread] Current Thread [Next in Thread]