[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Adding custom providers for thingatpt.el (was: [PATCH] Add support f
From: |
Ihor Radchenko |
Subject: |
Re: Adding custom providers for thingatpt.el (was: [PATCH] Add support for 'thing-at-point' to get URL at point) |
Date: |
Tue, 06 Feb 2024 12:38:19 +0000 |
Eli Zaretskii <eliz@gnu.org> writes:
> I think we do want to allow extending of this, but doesn't
> thingatpt.el already provide such capabilities? For example, I see
> this in bounds-of-thing-at-point:
> ...
> (cond
> ((get thing 'bounds-of-thing-at-point) <<<<<<<<<<<<<<<<<<<<<<<<
> (funcall (get thing 'bounds-of-thing-at-point)))
>
> Doesn't this provide the extension capabilities you are looking for?
> If not, why not?
Unlike `thing-at-point-provider-alist', which can be buffer-local,
symbol property is always global and setting it would override other
thing providers.
Note how `thing-at-point' uses
(cond
((let ((alist thing-at-point-provider-alist)
elt result)
(while (and alist (null result))
(setq elt (car alist)
alist (cdr alist))
(and (eq (car elt) thing)
(setq result (funcall (cdr elt)))))
result))
((get thing 'thing-at-point)
(funcall (get thing 'thing-at-point)))
checking `thing-at-point-provider-alist' and only then falling back to
`get'. What I am proposing is to add the equivalent alists for other
operators used by thingatpt.el.
--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>