'describe-function' shows function inferred type when available

* lisp/help-fns.el (help-fns--signature): Print function type for
native compiled code.
* etc/NEWS: Add entry.
This commit is contained in:
Andrea Corallo 2023-05-19 10:46:41 +02:00
parent 49c56f3335
commit ecc1d990d9
2 changed files with 10 additions and 1 deletions

View file

@ -30,6 +30,11 @@ applies, and please also update docstrings as needed.
* Changes in Emacs 30.1
** Help
** 'describe-function' shows function inferred type when available.
For native compiled Lisp functions 'describe-function' prints (after
the signature) the automatically inferred function type as well.
---
** New user option 'describe-bindings-outline-rules'.
This user option controls outline visibility in the output buffer of

View file

@ -710,7 +710,11 @@ the C sources, too."
(high-doc (cdr high)))
(unless (and (symbolp function)
(get function 'reader-construct))
(insert high-usage "\n"))
(insert high-usage "\n")
(when (and (featurep 'native-compile)
(subr-native-elisp-p (symbol-function function))
(subr-type (symbol-function function)))
(insert (format "\nInferred type: %s\n" (subr-type (symbol-function function))))))
(fill-region fill-begin (point))
high-doc)))))