summaryrefslogtreecommitdiff
path: root/doc/lispref/text.texi
diff options
context:
space:
mode:
authorLars Ingebrigtsen <larsi@gnus.org>2021-01-23 20:38:54 +0100
committerLars Ingebrigtsen <larsi@gnus.org>2021-01-23 20:40:07 +0100
commit259edd435e0c02c3c906e8b34e7ece37724ccf11 (patch)
tree42a012a41c0604572d073da97ad644c64c9887c5 /doc/lispref/text.texi
parent7c9841b8428edfbc369eccf54788b668d4b27328 (diff)
downloademacs-259edd435e0c02c3c906e8b34e7ece37724ccf11.tar.gz
emacs-259edd435e0c02c3c906e8b34e7ece37724ccf11.tar.bz2
emacs-259edd435e0c02c3c906e8b34e7ece37724ccf11.zip
Add a mechanism for buffer-local thing-at-points
* doc/lispref/text.texi (Buffer Contents): Document it. * lisp/thingatpt.el (thing-at-point-provider-alist): New variable. (thing-at-point): Use it.
Diffstat (limited to 'doc/lispref/text.texi')
-rw-r--r--doc/lispref/text.texi19
1 files changed, 19 insertions, 0 deletions
diff --git a/doc/lispref/text.texi b/doc/lispref/text.texi
index 35bc6f9f161..14854a5aafa 100644
--- a/doc/lispref/text.texi
+++ b/doc/lispref/text.texi
@@ -334,6 +334,25 @@ but there is no peace.
(thing-at-point 'whitespace)
@result{} nil
@end example
+
+@defvar thing-at-point-provider-alist
+This variable allows users and modes to tweak how
+@code{thing-at-point} works. It's an association list of @var{thing}s
+and functions (called with zero parameters) to return that thing.
+Entries for @var{thing} will be evaluated in turn until a
+non-@code{nil} result is returned.
+
+For instance, a major mode could say:
+
+@lisp
+(setq-local thing-at-point-provider-alist
+ (append thing-at-point-provider-alist
+ '((url . my-mode--url-at-point))))
+@end lisp
+
+If no providers have a non-@code{nil} return, the @var{thing} will be
+computed the standard way.
+@end defvar
@end defun
@node Comparing Text