emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master ecc1d990d9e: 'describe-function' shows function inferred type whe


From: Andrea Corallo
Subject: master ecc1d990d9e: 'describe-function' shows function inferred type when available
Date: Tue, 30 May 2023 12:28:46 -0400 (EDT)

branch: master
commit ecc1d990d9e9d006838ca514213ea5e46a459363
Author: Andrea Corallo <akrl@sdf.org>
Commit: Andrea Corallo <akrl@sdf.org>

    '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.
---
 etc/NEWS         | 5 +++++
 lisp/help-fns.el | 6 +++++-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/etc/NEWS b/etc/NEWS
index f5e15175016..80e997d420f 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -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
diff --git a/lisp/help-fns.el b/lisp/help-fns.el
index 1966193d1a7..c4e09e48bea 100644
--- a/lisp/help-fns.el
+++ b/lisp/help-fns.el
@@ -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)))))
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]