bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#37458: 27.0.50; number-at-point misses hex


From: Lars Ingebrigtsen
Subject: bug#37458: 27.0.50; number-at-point misses hex
Date: Fri, 20 Sep 2019 19:41:35 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Andreas Röhler <andreas.roehler@easy-emacs.de> writes:

> number-at-point from thingatpt.el doesn't recognize hex-numbers.
>
> Currently defined like that:
>
> (defun number-at-point ()
> \240 "Return the number at point, or nil if none is found."
> \240 (when (thing-at-point-looking-at "-?[0-9]+\\.?[0-9]*" 500)
> \240\240\240 (string-to-number
> \240\240\240\240 (buffer-substring (match-beginning 0) (match-end 0)))))

(You have something odd in your emails -- it seems like leading spaces
are transformed into char 240.)

I've now changed this to recognise some hex numbers if they're preceded
by #x or 0x.  Just looking for "bare" hex numbers may return too many
false positives.

> Maybe make the regexp customizable?

That wouldn't help much since the string has to be transformed to a
number in the right base.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





reply via email to

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