[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: |
Eli Zaretskii |
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 14:26:41 +0200 |
> From: Ihor Radchenko <yantar92@posteo.net>
> Cc: emacs-devel@gnu.org, emacs-orgmode@gnu.org
> Date: Mon, 05 Feb 2024 22:56:05 +0000
>
> Jim Porter <jporterbugs@gmail.com> writes:
>
> > On 2/5/2024 7:07 AM, Ihor Radchenko wrote:
> >> It would make sense to add a number of alists:
> >> - bounds-of-thing-at-point-provider-alist
> >> - same for 'forward-op, 'beginning-op, 'end-op.
> >>
> >> After Emacs have those, we can add Org mode support.
> >
> > That sounds reasonable enough to me; does anyone else have opinions on
> > this? Otherwise, I'll get to work on a patch (though probably not for a
> > couple weeks).
>
> CCing Stefan and Eli.
> Please, let us know if the above is something not wanted upstream.
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:
(defun bounds-of-thing-at-point (thing)
"Determine the start and end buffer locations for the THING at point.
THING should be a symbol specifying a type of syntactic entity.
Possibilities include `symbol', `list', `sexp', `defun', `number',
`filename', `url', `email', `uuid', `word', `sentence', `whitespace',
`line', and `page'.
See the file `thingatpt.el' for documentation on how to define a
valid THING.
Return a cons cell (START . END) giving the start and end
positions of the thing found."
(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?