GNU bug report logs -
#21391
24.5; `thing-at-point' returns error when called with arguments 'number t
Previous Next
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
Message #214 received at 21391 <at> debbugs.gnu.org (full text, mbox):
On 14.11.2016 16:36, Eli Zaretskii wrote:
>> From: Andreas Röhler <andreas.roehler <at> easy-emacs.de>
>> Date: Mon, 14 Nov 2016 11:26:54 +0100
>>
>> IMHO the current design is really confusing and shouldn't be kept.
> IMNSHO it would be madness to make incompatible changes 20 years after
> the code was admitted into Emacs.
>
>> 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.
> Correct. We have gobs of functions that can return several different
> kinds of objects.
>
>> Next clause deals with buffer-substring - which is thing-at-point about
>> in my understanding.
> IMO, your understanding is wrong at least since 1997.
So lets have closer a look at thing-at-point, which under the hood is
called also by list-at-point, form-at-point:
((text
(if (get thing 'thing-at-point)
(funcall (get thing 'thing-at-point))
(let ((bounds (bounds-of-thing-at-point thing)))
(when bounds
(buffer-substring (car bounds) (cdr bounds)))))))
The second clause returns a string. All further deals with this
string-var text AFAICS.
That's why I'm calling the string the native return type here.
The first clause was discussed above. Seeing just one use-case for now:
(put 'email 'thing-at-point
(lambda ()
(let ((boundary-pair (bounds-of-thing-at-point 'email)))
(if boundary-pair
(buffer-substring-no-properties
(car boundary-pair) (cdr boundary-pair))))))
However, also returning a string. And definitely dressed up from behind.
This bug report was last modified 4 years and 328 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.