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

From: Andreas Röhler <[email-masked]>
Date: Sun, 22 Sep 2019 17:44:03 +0200

On 20.09.19 19:41, Lars Ingebrigtsen wrote:
> Andreas Röhler <[email-masked]> 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.)

Sent from thunderbird. Not visible here. Also don't get the error when 
copying back from previous mail.

>
> 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.

Thanks.

>> Maybe make the regexp customizable?
> That wouldn't help much since the string has to be transformed to a
> number in the right base.
>