unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: Jean Louis <bugs@gnu.support>
Cc: Pedro Andres Aranda Gutierrez <paaguti@gmail.com>,
	emacs-devel <emacs-devel@gnu.org>
Subject: RE: Re: [External] : Re: Adding custom providers for thingatpt.el (was: [PATCH] Add support for 'thing-at-point' to get URL at point)
Date: Wed, 15 May 2024 20:56:54 +0000	[thread overview]
Message-ID: <SJ0PR10MB5488380A9EB7FFB66195B907F3EC2@SJ0PR10MB5488.namprd10.prod.outlook.com> (raw)
In-Reply-To: <ZkRs8IohEMdfQxEm@lco2>

> * Drew Adams <drew.adams@oracle.com> [2024-05-08 21:17]:
> > >> At the risk of veering off-topic (I mainly care about adding
> > >> 'bounds-of-thing-at-point-provider-alist' and
> > >> 'forward-thing-provider-alist'), would adding a new optional STRICT
> > >> argument to 'thing-at-point' and friends be an ok resolution for
> > >> everyone? This argument would enable Drew's proposed behavior. That
> way,
> > >> users get all the nice behavior by default just like today, and
> > >> programmers who require strict correctness in their code also have an
> > >> option.
> > >
> > > 1+ if STRICT means thing starting at point
> > > and without it we may need to look for the
> > > beginning of the thing (lazy point setting)....

Please don't (presumably accidentally) make it
look like you're responding to something I wrote,
but you actually quote two others - nothing at
all from me.  Thx.

> I was of understanding that it is the regular
> expression that decides what is on the point or not.

What regular expression?

Are you thinking of a regular expression that's
checked to see if some particular kind of thing
is at point, e.g. a regexp like the value of a
var such as `thing-at-point-newsgroup-regexp'?

Such a regexp doesn't determine/define what "at
point" means.

The question here is where you test for a thing
at point, i.e., what "at point" means.  It's not
about how you test that.  If your test function
actually checks something at a char that's not
at point, that's its prerogative.  It's about
the generic behavior of Thing At Point.

The char at point (which actually means the char
just after point) is well-defined.  That's what
the generic functions `bounds-of-thing-at-point'
and `thing-at-point' use as starting point.
Then then move forward and backward a THING etc.
to see if there's such a THING at that starting
point.

That movement is customizable (with properties
`forward-op', `beginning-op', `end-op',
`bounds-of-thing-at-point', `thing-at-point',
and in other ways).  But the starting position
is `(point)'; that's where the check is done.

The bug is in `bounds-of-thing-at-point'.  It
should be faithful to its name, and check only
at (point), not at EITHER point OR (1- (point)).

Even if the fix were to always check only at
(1- (point)), instead of (point), it would be
a legitimate fix for the problem caused by the
ambiguity: there's _no way to determine whether_
there's a thing at a given position.

The bugged behavior defeats the successive use
of functions that do something with _the next
thing_ at point when that _next thing butts up
against the previous thing_.

IOW, it technically doesn't matter which single
position is the "origin" for checking: (point)
or (1- (point)) or whatever else.  The bug is
that _no single_ position is used.

However, since "at point" does mean something
in Emacs English, the proper fix is to always
check starting from (point), not (1- (point))
or any other position.

Either always-(point) or always-(1- (point))
would be a fix.  But always-(point) is the
better/proper fix, just because it accords
with Emacs terminology.

  reply	other threads:[~2024-05-15 20:56 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-08 16:09 Re: [External] : Re: Adding custom providers for thingatpt.el (was: [PATCH] Add support for 'thing-at-point' to get URL at point) Pedro Andres Aranda Gutierrez
2024-05-08 18:14 ` Drew Adams
2024-05-15  8:06   ` Jean Louis
2024-05-15 20:56     ` Drew Adams [this message]
2024-05-15 21:25       ` Jean Louis
2024-05-15 21:56         ` Drew Adams
     [not found] <abbf9444-7bc7-83f1-f48a-632f4d7a6154@gmail.com>
2023-11-06 20:11 ` Ihor Radchenko
2023-11-06 20:53   ` Jim Porter
2024-02-05 15:07     ` Ihor Radchenko
2024-02-05 22:44       ` Jim Porter
2024-04-12 12:41         ` Ihor Radchenko
2024-04-12 22:30           ` Jim Porter
2024-04-29  4:26             ` Jim Porter
2024-04-29 18:14               ` Ihor Radchenko
2024-04-30  4:42                 ` Jim Porter
2024-04-30 11:39                   ` Ihor Radchenko
2024-04-30 18:27                     ` Jim Porter
2024-04-30 21:10                       ` [External] : " Drew Adams
2024-05-07  1:08                         ` Jim Porter
2024-05-07  1:52                           ` Drew Adams

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=SJ0PR10MB5488380A9EB7FFB66195B907F3EC2@SJ0PR10MB5488.namprd10.prod.outlook.com \
    --to=drew.adams@oracle.com \
    --cc=bugs@gnu.support \
    --cc=emacs-devel@gnu.org \
    --cc=paaguti@gmail.com \
    /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).