all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: f92capac@gmail.com, tino.calancha@gmail.com,
	9300@debbugs.gnu.org, dgutov@yandex.ru
Subject: bug#9300: 24.0.50; `bounds-of-thing-at-point' does not return nil when just after THING
Date: Mon, 20 Jun 2016 16:34:46 -0700 (PDT)	[thread overview]
Message-ID: <ee867b27-fdf5-4787-a106-d7df2fab986a@default> (raw)
In-Reply-To: <<83twgn7hjx.fsf@gnu.org>>

> > > FWIW, I agree with Dmitry: this has been a de-facto behavior long
> > > enough to consider it the correct one. If documentation is confusing
> > > in that it says otherwise, we should fix the documentation.
> >
> > I couldn't disagree more.
> >
> > It is wrong to consider the current behavior "the correct one",
> > regardless of how long it has been in place.  It is wrong because
> > you cannot use it in a general and precise way.  It is just broken.
> > It has been broken for a long time, but it is broken nevertheless.
> 
> That's immaterial.  It is being used in many places, and it's
> obviously useful.

It is not being used in _any_ place where it matters whether
there is a thing just before point but not at point.  It cannot
be used in such a place because of this bug.  Can you point to
such a use?

"It is obviously useful" ONLY for cases where you don't really
care _whether_ there is a thing at point and you only want to
get a thing at point or at point-minus-one - you prefer to get a
thing rather than nil, even if the thing is not quite at point.

Sure, such behavior can be useful if that's what one wants, and
"it is being used in many places" - to just grab something to
use as a default value.  But it is not always grabbing a thing
at point.

Just rename this grab-for-defaulting function: "*-near-point"
or "*-at-or-just-before-point".  It is not _at_ point.

> Somewhere in this long discussion there was a suggestion to
> add new functions that behave like you want.

It is not about what I want.  It is what "at point" means.
At_point_or_at_point_minus_one is not the same thing as at_point.
Currently the behavior is the former, not the latter.  That most
people don't notice or care about that is immaterial.

I already provided a correct implementation for at-point behavior.

And I already provided an implementation for near-point behavior,
albeit a better one than just at_point_or_at_point_minus_one.  For
the latter, you already have the current, broken implementation -
just rename it "*-near-point*".

> I suggest to invest energy in that direction, instead of more
> bikeshedding.

I'm not bikeshedding.  And I'll thank you to drop such a
characterization.  This is a real bug.  That you don't recognize
it is too bad.

I already invested energy in providing the function needed,
i.e., in fixing, as well as reporting, this bug.  And I (and
others) have been using the fix for decades.

I pointed you to code that provides not only the needed behavior
for `bounds-of-thing-at-point' but also other improvements for
thingatpt.el.  If you are uninterested, that's too bad.

> That way, everyone is happy, and you even get to prove you
> are right, if at some future point in time we will find that
> most applications switched to the new APIs.

Unlike some, I'm not really interested in proving I'm right.
But if you are interested, the proof is that you cannot use
the current code to distinguish whether there is a thing at
point from whether there is a thing at point-minus-one.

Can you point to a single use of thingatpt.el code that does
more than just use a thing at-or-just-before point as a
default value?  Can you point to a single use that really
cares about whether there actually is a thing at point, and
is not just trying to grab a thing near point?  A use where
a nil value is actually useful and taken into account as
more than simply a lack of a default value?

I don't think you'll find any (other than uses of my code).
This bug prevents using thing-at-point that way (general,
precise).  It confounds a thing at point with a thing at
point-minus-one.

I have what I need, in my own code.  You've heard in this
bug thread from a couple other users as well.  Lousy
bikeshedders too, no doubt.  But one of them has written his
own code that builds on thingatpt.el, and has clearly been
interested in thing-at-point and knowledgable about it for
years.  The other has contributed several uncontroversial
and non-bikeshed bug fixes to Emacs recently.

You will not hear from lots of others about this, naturally.
If one does not try to use thing-at-point to actually see
whether there is a thing at point then one will not even
notice this bug.

But if the bug is fixed then all kinds of possibilities
open up for handling multiple occurrences of a thing etc.,
possibilities that are precluded today, simply because the
code cannot tell the difference between there being a thing
at point and there being a thing at point-minus-one.
Dommage.

And if you fix this bug what happens to those who are using
the code today only to get a default value?  If point is
after a thing, and there is NO thing at point, then they
will get no default value.

If they complain about that in some context, you have only
to point them to your new `*-near-point' function for the
behavior they think they miss.  And for any occurrences in
Emacs code where you think that is the behavior you want,
just use the new function.

It's pretty simple, really.  If you want to improve Emacs
for thing-at-point, apply the one-off-bug fix and also
offer another function that maximizes returning a thing
rather than precisely getting a thing at point or returning
nil if there is none there.

My suggestion for the `*-near-point' function would be to
do something like what I did, letting users and code
control how near "near" is in any given context.  But if
you want to keep it rudimentary, where "near" means only
at point or at point-minus-one, then just rename the code
you have now to `*-near-point'.





  parent reply	other threads:[~2016-06-20 23:34 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-14 22:36 bug#9300: 24.0.50; `bounds-of-thing-at-point' does not return nil when just after THING Drew Adams
2016-06-20  9:21 ` Tino Calancha
2016-06-20 12:53   ` Dmitry Gutov
2016-06-20 13:11     ` Tino Calancha
2016-06-20 14:48   ` Eli Zaretskii
2016-06-21  3:01     ` Tino Calancha
     [not found]   ` <<8337o79arh.fsf@gnu.org>
2016-06-20 17:50     ` Drew Adams
2016-06-20 18:38       ` Andreas Röhler
2016-06-20 20:04       ` Eli Zaretskii
2016-06-21  6:14         ` Andreas Röhler
2016-06-21 12:50           ` Eli Zaretskii
2016-06-21 13:07             ` Andreas Röhler
2016-06-21 15:13               ` Eli Zaretskii
2016-06-21 13:31             ` Drew Adams
2016-06-21 15:16               ` Eli Zaretskii
2016-06-22  5:23             ` Fwd: " Andreas Röhler
2016-07-06 21:21               ` John Wiegley
2016-07-06 21:51                 ` Dmitry Gutov
2016-07-06 23:31                   ` Drew Adams
2016-07-07  8:00                     ` Andreas Röhler
2016-06-21 13:25           ` Drew Adams
     [not found]   ` <<<8337o79arh.fsf@gnu.org>
     [not found]     ` <<0e2c9c67-12a2-4712-92d2-e3c204f46838@default>
     [not found]       ` <<83twgn7hjx.fsf@gnu.org>
2016-06-20 23:34         ` Drew Adams [this message]
2016-06-20 23:59           ` Noam Postavsky
2016-06-21  0:47             ` Drew Adams
     [not found] <<B1052724B2D446C59E233FC1BD437723@us.oracle.com>
2015-07-29  1:44 ` Drew Adams
2016-01-15 13:33   ` Drew Adams
2016-02-23  1:01     ` Dmitry Gutov
2016-02-23  6:37       ` Drew Adams
2016-02-23  7:59         ` Andreas Röhler
2016-02-23 10:22         ` Dmitry Gutov
2016-02-23 16:15           ` Drew Adams
2016-02-24  0:52             ` Dmitry Gutov
2016-02-24  1:31               ` Drew Adams
2016-02-26  1:03                 ` Dmitry Gutov
2016-02-26  1:44                   ` Drew Adams
2016-02-26 10:15                     ` Dmitry Gutov
2016-02-26 14:39                       ` Drew Adams
2016-02-26 15:25                         ` Dmitry Gutov
2016-02-26 17:00                           ` Drew Adams
2022-04-28 11:24       ` Lars Ingebrigtsen
2022-04-28 15:49         ` 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

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

  git send-email \
    --in-reply-to=ee867b27-fdf5-4787-a106-d7df2fab986a@default \
    --to=drew.adams@oracle.com \
    --cc=9300@debbugs.gnu.org \
    --cc=dgutov@yandex.ru \
    --cc=eliz@gnu.org \
    --cc=f92capac@gmail.com \
    --cc=tino.calancha@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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.