GNU bug report logs - #21391
24.5; `thing-at-point' returns error when called with arguments 'number t

Previous Next

Package: emacs;

Reported by: Tino Calancha <f92capac <at> gmail.com>

Date: Tue, 1 Sep 2015 01:57:01 UTC

Severity: minor

Found in version 24.5

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 21391 <at> debbugs.gnu.org, tino.calancha <at> gmail.com
Subject: bug#21391: 24.5; `thing-at-point' should return a string
Date: Wed, 9 Nov 2016 02:04:20 +0200
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.

> If
> 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.




This bug report was last modified 4 years and 329 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.