Subject: RE: bug#21391: 24.5; `thing-at-point' should return a string

From: Drew Adams <[email-masked]>
Date: Mon, 14 Nov 2016 07:19:28 -0800 (PST)

> Look at the start of thing-at-point implementation:
> 
> if (get thing 'thing-at-point)
>    (funcall (get thing 'thing-at-point))
> 
> AFAIU an arbitrary function might  be stored here, no real
> relation to thing-at-point at all.

ANY time you use a function as a parameter (passed as an
argument, obtained as the value of a variable, or picked up
in some other way, such as here) there is little or no control
over the nature of that function in the function that makes
use of it.  It is up to the code that provides the function
to provide an appropriate function (DTRT).

> Next clause deals with buffer-substring - which is
> thing-at-point about in my understanding.

Your understanding is partial, then.  Thing-at-point has
been, from the outset, about actual Lisp THINGS, not just
strings that name such things.  Yes, string-naming-a-thing
is a common use case - the most common, currently.  But it
is only part of the story.

And yes, buffer text is usually examined to come up with
the returned THING.  But the buffer text need not be
examined.  What is most significant is point - the buffer
position.  And even that could be ignored by the function
that comes up with an appropriate THING to return.

thingatpt.el is much more general, and offers many more
possibilities, than just grabbing some text at or near
point.