GNU bug report logs - #37458
27.0.50; number-at-point misses hex

Previous Next

Package: emacs;

Reported by: Andreas Röhler <andreas.roehler <at> easy-emacs.de>

Date: Thu, 19 Sep 2019 11:25:02 UTC

Severity: wishlist

Tags: fixed

Found in version 27.0.50

Fixed in version 27.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Andreas Röhler <andreas.roehler <at> easy-emacs.de>
Cc: 37458 <at> debbugs.gnu.org
Subject: bug#37458: 27.0.50; number-at-point misses hex
Date: Fri, 20 Sep 2019 19:41:35 +0200
Andreas Röhler <andreas.roehler <at> 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




This bug report was last modified 5 years and 243 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.