Skip to content

Commit

Permalink
'describe-function' shows function inferred type when available
Browse files Browse the repository at this point in the history
* lisp/help-fns.el (help-fns--signature): Print function type for
native compiled code.
* etc/NEWS: Add entry.
  • Loading branch information
AndreaCorallo committed May 30, 2023
1 parent 49c56f3 commit ecc1d99
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions etc/NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion lisp/help-fns.el
Original file line number Diff line number Diff line change
Expand Up @@ -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)))))

Expand Down

0 comments on commit ecc1d99

Please sign in to comment.