From 512c9392cac0e9682e5f3306aa4355a996541d7b Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Wed, 22 May 2024 13:45:39 -0400 Subject: [PATCH 1/2] Rename `subr-native-elisp` to `native-comp-function` Now that this type name is displayed in *Help*, it is more important to use a name that is less weird for the unsuspecting user. * lisp/emacs-lisp/cl-preloaded.el (cl-functionp): Adjust to new name of native function's type. (subr-native-elisp-p): Redefine as an obsolete alias. (native-comp-function): Rename from `subr-native-elisp` * src/data.c (Fcl_type_of): Return `Qnative_comp_function` i.s.o `Qsubr_native_elisp`. (Fnative_comp_function_p): Rename from `Fsubr_native_elisp_p`. (syms_of_data): Adjust accordingly. * src/doc.c (Fsubr_documentation): Use new `Fnative_comp_function_p` name. --- etc/NEWS | 4 ++++ lisp/emacs-lisp/cl-preloaded.el | 5 +++-- src/data.c | 12 ++++++------ src/doc.c | 2 +- 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index d72ef5b5bef..c3e2b70bbc1 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1880,6 +1880,10 @@ documentation and examples. * Incompatible Lisp Changes in Emacs 30.1 +--- +** 'subr-native-elisp-p' is renamed to 'native-comp-function-p'. +The previous name still exists but is marked as obsolete. + +++ ** Evaluating a 'lambda' returns an object of type 'interpreted-function'. Instead of representing interpreted functions as lists that start with diff --git a/lisp/emacs-lisp/cl-preloaded.el b/lisp/emacs-lisp/cl-preloaded.el index fa745396b02..4b1bd2a9aff 100644 --- a/lisp/emacs-lisp/cl-preloaded.el +++ b/lisp/emacs-lisp/cl-preloaded.el @@ -355,7 +355,7 @@ cl-functionp This is like `functionp' except that it returns nil for all lists and symbols, regardless if `funcall' would accept to call them." (memq (cl-type-of object) - '(primitive-function subr-native-elisp module-function + '(primitive-function native-comp-function module-function interpreted-function byte-code-function))) (cl--define-built-in-type t nil "Abstract supertype of everything.") @@ -465,7 +465,8 @@ interpreted-function "Type of functions that have not been compiled.") (cl--define-built-in-type special-form (subr) "Type of the core syntactic elements of the Emacs Lisp language.") -(cl--define-built-in-type subr-native-elisp (subr compiled-function) +(define-obsolete-function-alias 'subr-native-elisp-p #'native-comp-function-p "30.1") +(cl--define-built-in-type native-comp-function (subr compiled-function) "Type of functions that have been compiled by the native compiler.") (cl--define-built-in-type primitive-function (subr compiled-function) "Type of functions hand written in C.") diff --git a/src/data.c b/src/data.c index 30d8eab7359..2ff5050580d 100644 --- a/src/data.c +++ b/src/data.c @@ -244,7 +244,7 @@ DEFUN ("cl-type-of", Fcl_type_of, Scl_type_of, 1, 1, 0, case PVEC_WINDOW: return Qwindow; case PVEC_SUBR: return XSUBR (object)->max_args == UNEVALLED ? Qspecial_form - : SUBR_NATIVE_COMPILEDP (object) ? Qsubr_native_elisp + : SUBR_NATIVE_COMPILEDP (object) ? Qnative_comp_function : Qprimitive_function; case PVEC_CLOSURE: return CONSP (AREF (object, CLOSURE_CODE)) @@ -1060,9 +1060,8 @@ DEFUN ("subr-name", Fsubr_name, Ssubr_name, 1, 1, 0, return build_string (name); } -DEFUN ("subr-native-elisp-p", Fsubr_native_elisp_p, Ssubr_native_elisp_p, 1, 1, - 0, doc: /* Return t if the object is native compiled lisp -function, nil otherwise. */) +DEFUN ("native-comp-function-p", Fnative_comp_function_p, Snative_comp_function_p, 1, 1, + 0, doc: /* Return t if the object is native compiled Lisp function, nil otherwise. */) (Lisp_Object object) { return SUBR_NATIVE_COMPILEDP (object) ? Qt : Qnil; @@ -4151,7 +4150,8 @@ #define PUT_ERROR(sym, tail, msg) \ DEFSYM (Qsubr, "subr"); DEFSYM (Qspecial_form, "special-form"); DEFSYM (Qprimitive_function, "primitive-function"); - DEFSYM (Qsubr_native_elisp, "subr-native-elisp"); + DEFSYM (Qsubr_native_elisp, "subr-native-elisp"); /* Deprecated name. */ + DEFSYM (Qnative_comp_function, "native-comp-function"); DEFSYM (Qbyte_code_function, "byte-code-function"); DEFSYM (Qinterpreted_function, "interpreted-function"); DEFSYM (Qbuffer, "buffer"); @@ -4286,7 +4286,7 @@ #define PUT_ERROR(sym, tail, msg) \ defsubr (&Sbyteorder); defsubr (&Ssubr_arity); defsubr (&Ssubr_name); - defsubr (&Ssubr_native_elisp_p); + defsubr (&Snative_comp_function_p); defsubr (&Ssubr_native_lambda_list); defsubr (&Ssubr_type); #ifdef HAVE_NATIVE_COMP diff --git a/src/doc.c b/src/doc.c index 36633a920c6..9cd8b60f118 100644 --- a/src/doc.c +++ b/src/doc.c @@ -431,7 +431,7 @@ DEFUN ("internal-subr-documentation", Fsubr_documentation, Ssubr_documentation, (Lisp_Object function) { #ifdef HAVE_NATIVE_COMP - if (!NILP (Fsubr_native_elisp_p (function))) + if (!NILP (Fnative_comp_function_p (function))) return native_function_doc (function); else #endif -- 2.43.0