branch: externals/compat
commit 492c0d1db1aa90d88db401bc20272dde905edb54
Author: Daniel Mendler <m...@daniel-mendler.de>
Commit: Daniel Mendler <m...@daniel-mendler.de>

    compat-28: Mark subr-native-elisp-p as obsolete
    
    The function has been renamed to native-comp-function-p in Emacs 30.
---
 NEWS.org        |  1 +
 compat-28.el    |  3 ++-
 compat-30.el    | 22 +++++++++++-----------
 compat-tests.el |  8 +++++---
 compat.texi     |  7 -------
 5 files changed, 19 insertions(+), 22 deletions(-)

diff --git a/NEWS.org b/NEWS.org
index 5520cf13b4..e3d008573e 100644
--- a/NEWS.org
+++ b/NEWS.org
@@ -4,6 +4,7 @@
 
 * Development
 
+- compat-28: Mark =subr-native-elisp-p= as obsolete (renamed in Emacs 30).
 - compat-30: New function =obarray-clear=.
 - compat-30: New function =interpreted-function-p=.
 - compat-30: New function =primitive-function-p=.
diff --git a/compat-28.el b/compat-28.el
index b5730b11f4..a03d3429b3 100644
--- a/compat-28.el
+++ b/compat-28.el
@@ -396,7 +396,8 @@ not a list, return a one-element list containing OBJECT."
 
 ;;;; Defined in data.c
 
-(compat-defalias subr-native-elisp-p ignore) ;; 
<compat-tests:subr-native-elisp-p>
+;; Renamed in Emacs 30 to `native-comp-function-p'.
+(compat-defalias subr-native-elisp-p ignore :obsolete t) ;; 
<compat-tests:subr-native-elisp-p>
 
 ;;;; Defined in subr-x.el
 
diff --git a/compat-30.el b/compat-30.el
index 81b8fefc8d..82cb242ef0 100644
--- a/compat-30.el
+++ b/compat-30.el
@@ -142,6 +142,16 @@ details."
 
 ;;;; Defined in subr.el
 
+(compat-defmacro static-if (condition then-form &rest else-forms) ;; 
<compat-tests:static-if>
+  "A conditional compilation macro.
+Evaluate CONDITION at macro-expansion time.  If it is non-nil,
+expand the macro to THEN-FORM.  Otherwise expand it to ELSE-FORMS
+enclosed in a `progn' form.  ELSE-FORMS may be empty."
+  (declare (indent 2) (debug (sexp sexp &rest sexp)))
+  (if (eval condition lexical-binding)
+      then-form
+    (cons 'progn else-forms)))
+
 (compat-defun closurep (object) ;; <compat-tests:closurep>
   "Return t if OBJECT is a function of type closure."
   (declare (side-effect-free error-free))
@@ -154,7 +164,7 @@ details."
 This excludes special forms, since they are not functions."
   (declare (side-effect-free error-free))
   (and (subrp object)
-       (not (or (subr-native-elisp-p object)
+       (not (or (with-no-warnings (subr-native-elisp-p object))
                 (special-form-p object)))))
 
 (compat-defalias drop nthcdr) ;; <compat-tests:drop>
@@ -230,16 +240,6 @@ By default we choose the head of the first list."
           tree))
     (copy-tree tree vectors-and-records)))
 
-(compat-defmacro static-if (condition then-form &rest else-forms) ;; 
<compat-tests:static-if>
-  "A conditional compilation macro.
-Evaluate CONDITION at macro-expansion time.  If it is non-nil,
-expand the macro to THEN-FORM.  Otherwise expand it to ELSE-FORMS
-enclosed in a `progn' form.  ELSE-FORMS may be empty."
-  (declare (indent 2) (debug (sexp sexp &rest sexp)))
-  (if (eval condition lexical-binding)
-      then-form
-    (cons 'progn else-forms)))
-
 ;;;; Defined in fns.c
 
 (compat-defun value< (a b) ;; <compat-tests:value<>
diff --git a/compat-tests.el b/compat-tests.el
index ec6f95ed73..19841d8cd3 100644
--- a/compat-tests.el
+++ b/compat-tests.el
@@ -212,7 +212,7 @@
     (should-equal 'h (get-text-property 0 'help-echo b))
     (should-equal 'h (get-text-property 5 'help-echo b))))
 
-(ert-deftest compat-button-buttonize ()
+(ert-deftest compat-obsolete-button-buttonize ()
   (let ((b (with-no-warnings (button-buttonize "button" 'c 'd))))
     (should-equal b "button")
     (should-equal 'c (get-text-property 0 'action b))
@@ -1313,8 +1313,10 @@
 (ert-deftest compat-native-comp-available-p ()
   (should (memq (native-comp-available-p) '(nil t))))
 
-(ert-deftest compat-subr-native-elisp-p ()
-  (should-not (subr-native-elisp-p (symbol-function 'identity))))
+(ert-deftest compat-obsolete-subr-native-elisp-p ()
+  (with-no-warnings
+    (static-if (< emacs-major-version 30)
+        (should-not (subr-native-elisp-p (symbol-function 'identity))))))
 
 (ert-deftest compat-closurep ()
   (should (interpreted-function-p (eval '(lambda (x) x) t)))
diff --git a/compat.texi b/compat.texi
index 8d6dd5089a..0efb3f759e 100644
--- a/compat.texi
+++ b/compat.texi
@@ -2132,13 +2132,6 @@ native compilation is not available, this function 
behaves identically
 to @code{subrp}.
 @end defun
 
-@c based on lisp/subr.el
-@defun subr-native-elisp-p object
-Return @code{t} if @var{object} if the object is native compiled lisp.
-If native compilation is not available, this function always returns
-@code{nil}.
-@end defun
-
 @c copied from lispref/compile.texi
 @defun native-comp-available-p
 This function returns non-@code{nil} if the running Emacs process has

Reply via email to