]> git.eshelyaron.com Git - emacs.git/commit
Allow defining custom providers for more "thingatpt" functions
authorJim Porter <jporterbugs@gmail.com>
Mon, 29 Apr 2024 04:19:53 +0000 (21:19 -0700)
committerEshel Yaron <me@eshelyaron.com>
Thu, 23 May 2024 07:44:44 +0000 (09:44 +0200)
commit363b0260cd963c8c979b0cb17156cf997ec2a9e6
tree7ff89437ecb18809515e3a51725732b2725c4267
parent8c246612804c020d05a63e9e0127ec75653db244
Allow defining custom providers for more "thingatpt" functions

This also fixes an issue in EWW and bug-reference-mode where
(thing-at-point 'url) at the end of a URL would return nil.

See <https://lists.gnu.org/archive/html/emacs-devel/2024-02/msg00200.html>.

* lisp/thingatpt.el (forward-thing-provider-alist)
(bounds-of-thing-at-point-provider-alist): New variables...
(forward-thing, bounds-of-thing-at-point): ... use them.
(text-property-search-forward, text-property-search-backward)
(prop-match-beginning, prop-match-end): Declare.
(thing-at-point-for-text-property, forward-thing-for-text-property)
(bounds-of-thing-at-point-for-text-property): New functions.

* lisp/net/eww.el (eww--url-at-point): Use
'thing-at-point-for-text-property'.
(eww--bounds-of-url-at-point, eww--forward-url): New functions...
(eww-mode): ... use them.

* lisp/progmodes/bug-reference.el (bug-reference--url-at-point): Use
'thing-at-point-for-text-property'.
(bug-reference--bounds-of-url-at-point, bug-reference--forward-url): New
functions...
(bug-reference--init): ... use them.

* test/lisp/thingatpt-tests.el (thing-at-point-providers)
(forward-thing-providers, bounds-of-thing-at-point-providers): New
tests.

* etc/NEWS: Announce this change.

(cherry picked from commit ae9045a8bd8d3917feb570adfab0b929b120a8e5)
etc/NEWS
lisp/net/eww.el
lisp/progmodes/bug-reference.el
lisp/thingatpt.el
test/lisp/thingatpt-tests.el