diff options
author | Daniel Martín <mardani29@yahoo.es> | 2023-02-28 23:15:40 +0100 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2023-03-12 09:54:06 +0200 |
commit | 29227e7c19100bed30b3410b399ee6a2c1ca7213 (patch) | |
tree | 4cfde01d3e6841d9ea54194c1e3bb785d464c8b7 /doc/lispref/help.texi | |
parent | 31f18480ca7291070837a305c64685c3e76afde3 (diff) | |
download | emacs-29227e7c19100bed30b3410b399ee6a2c1ca7213.tar.gz |
Add functions to query Emacs Lisp examples registered in shortdoc
* lisp/emacs-lisp/shortdoc.el (shortdoc--display-function): Add
a new shortdoc-example text property so that ELisp examples can
be searched for later.
(shortdoc--insert-group-in-buffer): New function extracted from
the buffer insertion code in 'shortdoc-display-group'.
(shortdoc-display-group): Implement in terms of
'shortdoc--insert-group-in-buffer'.
(shortdoc-function-examples): New function that returns an alist
of Emacs Lisp examples from shortdoc.
(shortdoc-help-fns-examples-function): New function to insert
Emacs Lisp function examples in *Help* buffers, if added to
'help-fns-describe-function-functions'.
*
test/lisp/emacs-lisp/shortdoc-tests.el (shortdoc-function-examples-test):
Test it.
* doc/emacs/help.texi (Name Help): Document in the user manual.
* doc/lispref/help.texi (Documentation Groups): Document it.
* etc/NEWS: Advertise it. (Bug#61877)
Diffstat (limited to 'doc/lispref/help.texi')
-rw-r--r-- | doc/lispref/help.texi | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/doc/lispref/help.texi b/doc/lispref/help.texi index 59b6b6dab1d..3175f66122e 100644 --- a/doc/lispref/help.texi +++ b/doc/lispref/help.texi @@ -989,3 +989,29 @@ in the function group to insert the function into. If @var{group} doesn't exist, it will be created. If @var{section} doesn't exist, it will be added to the end of the function group. @end defun + +You can also query the examples of use of functions defined in +shortdoc groups. + +@defun shortdoc-function-examples function +This function returns all shortdoc examples for @var{function}. The +result is an alist with items of the form + +@example +(@var{group} . @var{examples}) +@end example + +@noindent +where @var{group} is a documentation group where @var{function} +appears in and @var{examples} is a string with the examples of use of +@var{function} defined in @var{group}. + +@code{shortdoc-function-examples} returns @code{nil} if @var{function} +is not a function or if it doesn’t contain shortdoc information. +@end defun + +@defun shortdoc-help-fns-examples-function function +This function queries the registered documentation groups and inserts +examples of use of a given Emacs Lisp function into the current +buffer. +@end defun |