[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, 30 Apr 2024 11:39:42 +0000 |
Jim Porter <jporterbugs@gmail.com> writes:
> + (setq-local bounds-of-thing-at-point-provider-alist
> + (append bounds-of-thing-at-point-provider-alist
> + '((url . eww--bounds-of-url-at-point))))
> + (setq-local forward-thing-provider-alist
> + (append forward-thing-provider-alist
> + '((url . eww--forward-url))))
> ...
What happens if you have multiple providers for an URL?
You add the provider to the end, so it will have the lower priority in
this scenario. I guess that you want the opposite - EWW provider to take
precedence. Same for other changes.
> +(ert-deftest thing-at-point-providers ()
> ...
> +(ert-deftest forward-thing-providers ()
> ...
> +(ert-deftest bounds-of-thing-at-point-providers ()
> + (with-temp-buffer
> + (setq-local bounds-of-thing-at-point-provider-alist
> + `((url . ,(lambda ()
> + (bounds-of-thing-at-point-for-text-property
> + 'my-url)))))
It would make sense to add tests for "first wins" behaviour.
--
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>