Subject: bug#8628: 24.0.50; `thing-at-point-bounds-of-list-at-point' - no good

From: "Drew Adams" <[email-masked]>
Date: Thu, 7 Jul 2011 14:27:17 -0700

> This is incorrect; thing-at-point-bounds-of-list-at-point is a helper
> function that is called by `bounds-of-thing-at-point'.  If removed,
> (bounds-of-thing-at-point 'list) no longer works.

You're dreaming.  Did you actually try the bug recipe?  Did you then try it
again without `t-a-p-b-o-l-a-p' and its associated `put'?  Which one DTRT?

> I've marked thing-at-point-bounds-of-list-at-point explicitly as an
> internal function,

Irrelevant.  That has nothing to do with this bug.

> and will close this bug.

Wrong.  `thing-at-point-bounds-of-list-at-point' does NOT DTRT - at all.  And
that _causes_ (bounds-of-thing-at-point 'list) to not DTRT.  That is what this
bug report is about: (bounds-of-thing-at-point 'list).

But ordinary (bounds-of-thing-at-point 'list) WILL work, if you just get rid of
`thing-at-point-bounds-of-list-at-point' and its associated `put':

(put 'list 'bounds-of-thing-at-point
     'thing-at-point-bounds-of-list-at-point)

IOW, let `bounds-of-thing-at-point' do its normal thing for `list'.

Please read the bug thread.  Do I really need to repeat it?

Follow the recipe, at least - it's quite clear.  Regardless of whether you like
the fix I suggested, you should at least be able to confirm that the bug exists.

To make things clearer for you, substitute (bounds-of-thing-at-point 'list) for
(thing-at-point-bounds-of-list-at-point) in the recipe.  The former just uses
the latter, so they are the same thing, but apparently you've gotten confused
because I mentioned t-o-p-b-o-l-a-p.

You can see for yourself that (bounds-of-thing-at-point 'list) returns erroneous
results instead of nil when point is not on a list.  Try it.

And no, there is no need for such a "helper" function in the general case and,
as it turns out, in the case of `list' as well.  The idea is that
`bounds-of-thing-at-point' should just work for most THINGs.  And it DOES work
for `list' AFAICT.

More importantly, the helper function `thing-at-point-bounds-of-list-at-point'
does NOT work.  (bounds-of-thing-at-point 'list) should not return non-nil if
point is not on a list.  And `bounds-of-thing-at-point' should never, ever
return an empty thing (equal bounds), as it does here at eol per the recipe.

I just repeated the recipe in the latest Windows build of Emacs 24 - same
problem.

I get the impression that you have not really read this bug report at all.  Your
responses so far have been:

1. "Nobody should care about t-a-p-b-o-l-a-p because it's an internal function."

I do not care about t-a-p-b-o-l-a-p.  I care about the behavior of
`bounds-of-thing-at-point'.  The former is breaking the latter.

2. Just repeating that t-a-p-b-o-l-a-p is an internal function.

This was after I underlined the fact that it is the _behavior_ of
`bounds-of-thing-at-point' that is erroneous, _because of_ t-a-p-b-o-l-a-p.

3. Assignment to the wish list!

Even though I already provided the fix.

4. And now, what you write above, and closing the bug.  Sheesh.

You (pl.) apparently just don't get it.

a. The _behavior_ of `bounds-of-thing-at-point' is erroneous for THING = `list'.
It returns non-nil when point is not on a list in at least two cases, and it
returns an empty thing (empty bounds), which it should _never_ do.

b. It is this _behavior_ that needs to be fixed, however you might like to do
it.  It does not matter whether you choose to use an internal function such as
t-a-p-b-o-l-a-p or not, provided you do _fix the behavior_.

c. The simplest way to fix the behavior, IMHO - but you need not listen to it if
you prefer some other way - is to just get rid of the erroneous
`t-a-p-b-o-l-a-p' (and its associated `put') and let `bound-of-thing-at-point'
do its normal thing.  _That works_ for the cases cited.

Please read the bug report.  Try the recipe.  Fix the problem any way you like,
but please fix it.  This is NOT about internal vs external functions.  This is
about bugged _BEHAVIOR_.

Forget about `t-a-p-b-o-l-a-p'.  This is about the behavior of
`bounds-of-thing-at-point'.  The only reason I mentioned `t-a-p-b-o-l-a-p' is
that that is what screws up the behavior of `bounds-of-thing-at-point'.  Get rid
of the latter and its associated `put' and the former will DTRT for `list'.

Try it.