[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
scratch/func-type-decls acb51997524 5/6: Update C-h f
From: |
Andrea Corallo |
Subject: |
scratch/func-type-decls acb51997524 5/6: Update C-h f |
Date: |
Fri, 23 Feb 2024 10:12:13 -0500 (EST) |
branch: scratch/func-type-decls
commit acb519975247ff2656737774fa3d7dcf98faccaa
Author: Andrea Corallo <acorallo@gnu.org>
Commit: Andrea Corallo <acorallo@gnu.org>
Update C-h f
---
lisp/emacs-lisp/comp-common.el | 29 +++++++++++++++--------------
lisp/help-fns.el | 2 +-
2 files changed, 16 insertions(+), 15 deletions(-)
diff --git a/lisp/emacs-lisp/comp-common.el b/lisp/emacs-lisp/comp-common.el
index 0fab976474f..3aa0da60440 100644
--- a/lisp/emacs-lisp/comp-common.el
+++ b/lisp/emacs-lisp/comp-common.el
@@ -197,32 +197,33 @@ Account for `native-comp-eln-load-path' and
`comp-native-version-dir'."
(expand-file-name dir invocation-directory))))
native-comp-eln-load-path))
+;; FIXME now that is possible we should move this to help-fns.el
;;;###autoload
(defun comp-function-type-spec (function)
"Return the type specifier of FUNCTION.
-This function returns a cons cell whose car is the function
-specifier, and cdr is a symbol, either `inferred' or `declared'.
-If the symbol is `inferred', the type specifier is automatically
-inferred from the code itself by the native compiler; if it is
-`know', the type specifier comes from `comp-primitive-type-specifiers'."
+This function returns a cons cell whose car is the function specifier,
+and cdr is a symbol, either `inferred' or `declared'. If the symbol is
+`inferred', the type specifier is automatically inferred from the code
+itself by the native compiler; if it is `declared', the type specifier
+comes from the function declaration."
(let ((kind 'declared)
type-spec)
- (when-let ((res (assoc function comp-primitive-type-specifiers)))
- ;; Declared primitive
- (setf type-spec (cadr res)))
- (let ((f (and (symbolp function)
- (symbol-function function))))
- (when (and f (null type-spec))
+ (when-let ((symp (symbolp function))
+ (f (symbol-function function)))
+ (if-let ((primitive (subr-primitive-p f))
+ (type (subr-type f)))
+ ;; Declared primitive
+ (setf type-spec type)
(if-let ((delc-type (function-get function 'declared-type)))
;; Declared Lisp function
(setf type-spec (cons 'function delc-type))
(when (subr-native-elisp-p f)
;; Native compiled inferred
(setf kind 'inferred
- type-spec (subr-type f))))))
- (when type-spec
- (cons type-spec kind))))
+ type-spec (subr-type f)))))
+ (when type-spec
+ (cons type-spec kind)))))
(provide 'comp-common)
diff --git a/lisp/help-fns.el b/lisp/help-fns.el
index 15d87f9925c..00c3edb400a 100644
--- a/lisp/help-fns.el
+++ b/lisp/help-fns.el
@@ -734,7 +734,7 @@ the C sources, too."
(insert (format
(if (eq kind 'inferred)
"\nInferred type: %s\n"
- "\nType: %s\n")
+ "\nDeclared type: %s\n")
type-spec))))
(fill-region fill-begin (point))
high-doc)))))
- scratch/func-type-decls updated (1d630a5e08a -> e8ef297bbea), Andrea Corallo, 2024/02/23
- scratch/func-type-decls 4ae6ac9788b 3/6: Rename comp-primitive-type-specifiers, Andrea Corallo, 2024/02/23
- scratch/func-type-decls acb51997524 5/6: Update C-h f,
Andrea Corallo <=
- scratch/func-type-decls 22da320285a 4/6: Make use of Lisp function declarations in the native compiler, Andrea Corallo, 2024/02/23
- scratch/func-type-decls 45e94db72df 2/6: Move remaning declared types out of comp-known-type-specifiers, Andrea Corallo, 2024/02/23
- scratch/func-type-decls e8ef297bbea 6/6: Clean-up now unnecessary 'comp-primitive-type-specifiers', Andrea Corallo, 2024/02/23
- scratch/func-type-decls 202c30af99c 1/6: Add function type declarations for Lisp functions as well, Andrea Corallo, 2024/02/23