unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: "Andreas Röhler" <andreas.roehler@easy-emacs.de>
Cc: 37458@debbugs.gnu.org
Subject: bug#37458: 27.0.50; number-at-point misses hex
Date: Fri, 20 Sep 2019 19:41:35 +0200	[thread overview]
Message-ID: <87pnjuamr4.fsf@gnus.org> (raw)
In-Reply-To: <a373860c-9b9f-f796-d1c2-b4c2d46809cb@easy-emacs.de> ("Andreas \=\?utf-8\?Q\?R\=C3\=B6hler\=22's\?\= message of "Thu, 19 Sep 2019 13:18:51 +0200")

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	other threads:[~2019-09-20 17:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-19 11:18 bug#37458: 27.0.50; number-at-point misses hex Andreas Röhler
2019-09-20 17:41 ` Lars Ingebrigtsen [this message]
2019-09-22 15:44   ` Andreas Röhler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87pnjuamr4.fsf@gnus.org \
    --to=larsi@gnus.org \
    --cc=37458@debbugs.gnu.org \
    --cc=andreas.roehler@easy-emacs.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).