unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: Noam Postavsky <npostavs@users.sourceforge.net>
Cc: Stephen Berman <stephen.berman@gmx.net>, 24969@debbugs.gnu.org
Subject: bug#24969: 26.0.50; number-at-point
Date: Sun, 20 Nov 2016 08:58:07 -0800 (PST)	[thread overview]
Message-ID: <ad125f85-2bc3-47e2-8236-363317229e82@default> (raw)
In-Reply-To: <CAM-tV-8bs_=3oFc_F0TDS4QhwaJiaP-KXha14Co=cvB3qQRTZA@mail.gmail.com>

> > In Emacs 25.1 (emacs -Q), `number-at-point' at either
> > the `-' or the `1' returns nil, for me.  And I do not
> > see why it should return a number.
> 
> With 25.1 I get nil, on 26.0.50 I'm getting -1. I believe this is
> due to the fix in https://debbugs.gnu.org/cgi/bugreport.cgi?bug=24605

I see.  Dunno what I think about this.  I'd be interested to
hear more from Tino about this.  It clearly is not backward
compatible.  Whether it is an improvement or not, I'm not
sure, in this case.

I guess it depends on what a user would expect of a
"number-at-point" function.  A priori, I don't see why s?he
would expect a non-nil answer if the numeral is embedded in
text that does not delimit a numeral (e.g. non whitespace text).
But maybe it is OK.

Would we expect the same kind of behavior for `sexp-at-point'
if a sexp were not surrounded by chars that delimit a sexp?

In Lisp, at least, there is no number at point, in `foo-2'.
That is, the Lisp parser (reader) would never pick up the
`2' as a number here.

I'm partial to use of thingatpt for Lisp, but I realize that
it is used in other contexts too.  I would probably prefer
that, whatever the context, if the context has a notion of
number and its syntax (numerals) then `number-at-point'
would return a number ONLY when there is really a number
at point, based on the meaning of numeral in that context.

If we could do that well, that would be best, I think.  In
the case of Lisp, it is clear (to me) that returning a number
for `foo-2', with point on the `2', is wrong.

I think we need to think more about this.  One option is
to provide two different functions, one of which does what
has been done in the past and one of which tries to be
smarter along the lines of fixing this bug (but not
necessarily along the lines of the implemented fix).

IOW, I agree with the bug report that `form-at-point'
should - somehow - handle the case where `thing-at-point'
returns a non-string.  There is a bug to be fixed.  But
I'm not convinced that the fix we've implemented is TRT.

I'm open to being convinced otherwise, but this does not
seeme right to me, so far.  It seems like we should be able
to do better, here.





  reply	other threads:[~2016-11-20 16:58 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-20 12:47 bug#24969: 26.0.50; number-at-point Andreas Röhler
2016-11-20 12:53 ` Stephen Berman
2016-11-20 13:53   ` Andreas Röhler
2016-11-20 14:15     ` npostavs
2016-11-20 16:19       ` Drew Adams
2016-11-20 16:35         ` Noam Postavsky
2016-11-20 16:58           ` Drew Adams [this message]
2016-11-20 19:26             ` Andreas Röhler
2016-11-20 21:28               ` Drew Adams
2016-11-21  6:48                 ` Andreas Röhler
2016-11-21 14:22                   ` Drew Adams
2016-11-21 13:09         ` Tino Calancha
2016-11-21 23:07           ` Drew Adams
2016-11-22  8:45             ` Andreas Röhler
2021-08-10 16:18 ` Lars Ingebrigtsen

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=ad125f85-2bc3-47e2-8236-363317229e82@default \
    --to=drew.adams@oracle.com \
    --cc=24969@debbugs.gnu.org \
    --cc=npostavs@users.sourceforge.net \
    --cc=stephen.berman@gmx.net \
    /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).