From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#71123: [PATCH] Rename `subr-native-elisp` to `native-comp-function` Date: Wed, 22 May 2024 13:50:17 -0400 Message-ID: Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="3181"; mail-complaints-to="usenet@ciao.gmane.io" Cc: monnier@iro.umontreal.ca To: 71123@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed May 22 19:51:10 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1s9q7J-0000b5-Ld for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 22 May 2024 19:51:09 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s9q79-0003KX-HK; Wed, 22 May 2024 13:50:59 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s9q77-0003KA-7z for bug-gnu-emacs@gnu.org; Wed, 22 May 2024 13:50:58 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s9q76-0006BA-L4 for bug-gnu-emacs@gnu.org; Wed, 22 May 2024 13:50:56 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1s9q7C-0005hO-FH; Wed, 22 May 2024 13:51:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: monnier@iro.umontreal.ca, bug-gnu-emacs@gnu.org Resent-Date: Wed, 22 May 2024 17:51:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 71123 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org X-Debbugs-Original-Xcc: monnier@iro.umontreal.ca Original-Received: via spool by submit@debbugs.gnu.org id=B.171640024821898 (code B ref -1); Wed, 22 May 2024 17:51:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 22 May 2024 17:50:48 +0000 Original-Received: from localhost ([127.0.0.1]:57298 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s9q6x-0005h8-LY for submit@debbugs.gnu.org; Wed, 22 May 2024 13:50:48 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:50650) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s9q6t-0005h2-Dd for submit@debbugs.gnu.org; Wed, 22 May 2024 13:50:46 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s9q6m-00032e-EB for bug-gnu-emacs@gnu.org; Wed, 22 May 2024 13:50:37 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s9q6h-00068j-Uf for bug-gnu-emacs@gnu.org; Wed, 22 May 2024 13:50:36 -0400 Original-Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id F2BF5444718 for ; Wed, 22 May 2024 13:50:28 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1716400223; bh=qyuxB7zCcLfZQH272DSrnFBFRxFOlSb/DgrJ2DxxCFA=; h=From:To:Subject:Date:From; b=lrzXDl+fO+HXXMWi4/rmF1/cB80dbgaAXWMCDnj4s2IPXScnPGyv53e8wzSK9XvD3 PvAPbHDNBXaM3yk5JEcVGJ2Iw6iQxQ5NDF0e7lmcwnT4wcKbFZGp8TQq4oo/6jPqVw pHjSkSObftshOYJhp0mATP8WEBA8pMqx/rFCmcPcvj9WahXB6JYT7IcuchWSZEYL0J /gmVbg8b5ngSFxl4Pw7pTm6mkp3EyQN/5xwbsqtIizMTyziQXZiK/yJcwgnlJQTA5T SldsVOuZGiblfMMd9pxuSxceB0qOHRTmRKxAvIija1Z/qRXCZylBfl8O2e+jDSsvhH 2dZeIe/OcnsbQ== Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id CF4AF44471A for ; Wed, 22 May 2024 13:50:23 -0400 (EDT) Original-Received: from lechazo (lechon.iro.umontreal.ca [132.204.27.242]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id C1CCC120230 for ; Wed, 22 May 2024 13:50:23 -0400 (EDT) Received-SPF: pass client-ip=132.204.25.50; envelope-from=monnier@iro.umontreal.ca; helo=mailscanner.iro.umontreal.ca X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:285644 Archived-At: --=-=-= Content-Type: text/plain Tags: patch I can't remember where someone requested a nicer name than `subr-native-elisp`, but here's a patch which aims to do that. AFAICT we do not need to preserve the *type* `subr-native-elisp` because it was never exposed to ELisp before Emacs-30 anyway. So the only backward compatibility needed is the `subr-native-elisp-p` function. I chose `native-comp-function` as the new name based on a few `grep`s through our C code which suggested that `native-comp-` is the most "popular" prefix in there from code related to native compilation. I don't have a strong preference, so if there's a consensus around another name, I'll happily change the patch accordingly. Stefan In GNU Emacs 30.0.50 (build 2, i686-pc-linux-gnu, GTK+ Version 3.24.41, cairo version 1.18.0) of 2024-03-06 built on lechazo Repository revision: b0d12d2b65c94af306c8f116a3dfb0040e2feef3 Repository branch: work Windowing system distributor 'The X.Org Foundation', version 11.0.12101011 System Description: Debian GNU/Linux trixie/sid Configured using: 'configure -C --enable-checking --enable-check-lisp-object-type --with-modules --with-cairo --with-tiff=ifavailable 'CFLAGS=-Wall -g3 -Og -Wno-pointer-sign' --without-native-compilation PKG_CONFIG_PATH=/home/monnier/lib/pkgconfig' --=-=-= Content-Type: text/patch Content-Disposition: attachment; filename=0001-Rename-subr-native-elisp-to-native-comp-function.patch >From a0df6f4eabf0f64267b6d31905982e620f581a3f Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Wed, 22 May 2024 13:45:39 -0400 Subject: [PATCH] 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. --- lisp/emacs-lisp/cl-preloaded.el | 5 +++-- src/data.c | 12 ++++++------ src/doc.c | 2 +- 3 files changed, 10 insertions(+), 9 deletions(-) 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 --=-=-=--