[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

From: Dmitry Gutov
Subject: bug#21391: 24.5; `thing-at-point' should return a string
Date: Wed, 9 Nov 2016 02:04:20 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:50.0) Gecko/20100101 Thunderbird/50.0

On 08.11.2016 17:05, Eli Zaretskii wrote:

But then somehow the discussion shifted to be about whether to _force_
thing-at-point value to be a string, even if it isn't for some reason.

I'd suggest trying to fix that from the other end, as one alternative. If we agree that the return value of thing-at-point should be a string, (get 'number 'thing-at-point) can't return `number-at-point', it should return a function that will return the said number as a string.

And of all things enumerated in thing-at-point's docstring, IIUC only number has such problem. Which leaves third-party things, but, they will either need to be fixed, or people will have to remain content not to use thing-at-point with NO-PROPERTIES argument on them.

I don't understand the rationale for such a change.  Yes,
thing-at-point was most probably always meant to return a string.
Yes, Lisp code that causes it to return some other object is probably
wrong.  However, the change that allowed this was introduced 19 years
ago; who knows what code out there actually uses this loophole?

I can't imagine that loophole to be too useful. The proposal above should leave all such uses of third-party things alone. But yes, anyone who uses (thing-at-point 'number) as a (longer, pointless) substitute for (number-at-point) will have to change their code.

there is such code, why would we want to break it?  To what end?  And
if no code uses this loophole, why do we care that it exists?

To make thing-at-point behavior more consistent. This kind of thing is usually performed with future new uses in mind. But it also might help with code maintenance a bit, for existing users (not likely to make much of a difference, but still; the danger of breakage is not very significant either).

IOW, thing-at-point no longer has any known bugs, and we are talking
about forcibly breaking a use case that does no harm to us, and can
only happen if someone abuses the 'thing-at-point' property, which
would make it that someone's bug/misfeature, for them to fix.

Yes. The fix is very easy, though, for projects that retain at least somewhat active maintainer.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]