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: Andreas Röhler
Subject: bug#37458: 27.0.50; number-at-point misses hex
Date: Sun, 22 Sep 2019 17:44:03 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:60.0) Gecko/20100101 Thunderbird/60.9.0


On 20.09.19 19:41, Lars Ingebrigtsen wrote:
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.)

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.






reply via email to

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