aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Mendler <mail@daniel-mendler.de>2023-01-15 06:31:00 +0100
committerDaniel Mendler <mail@daniel-mendler.de>2023-01-15 06:36:49 +0100
commite9fae0ff26db7140411cb3d039a88902a0dc6ea3 (patch)
tree2c28d91914db42ceee874da5fe08d4e5d487ebcc
parent63bd5c2554a9fcbff5569ab1ba836e8c3b562005 (diff)
compat-28: Add subr-native-elisp-p
-rw-r--r--NEWS.org1
-rw-r--r--compat-28.el4
-rw-r--r--compat-tests.el5
-rw-r--r--compat.texi9
4 files changed, 17 insertions, 2 deletions
diff --git a/NEWS.org b/NEWS.org
index 07e378d..f8f83c9 100644
--- a/NEWS.org
+++ b/NEWS.org
@@ -5,6 +5,7 @@
- compat-27: Add ~fixnump~ and ~bignump~.
- compat-27: Add generalized variables for ~decoded-time-*~.
- compat-28: Add ~macroexp-warn-and-return~.
+- compat-28: Add ~subr-native-elisp-p~.
* Release of "Compat" Version 29.1.1.1
diff --git a/compat-28.el b/compat-28.el
index 6a5b035..e97028c 100644
--- a/compat-28.el
+++ b/compat-28.el
@@ -424,6 +424,10 @@ not a list, return a one-element list containing OBJECT."
(compat-defalias subr-primitive-p subrp) ;; <OK>
+;;;; Defined in data.c
+
+(compat-defalias subr-native-elisp-p ignore) ;; <OK>
+
;;;; Defined in subr-x.el
(compat-defun string-clean-whitespace (string) ;; <OK>
diff --git a/compat-tests.el b/compat-tests.el
index f4b9933..5d7423e 100644
--- a/compat-tests.el
+++ b/compat-tests.el
@@ -901,9 +901,12 @@
(should-equal 'l (cddadr xxxx))
(should-equal 'h (cdddar xxxx))))
+(ert-deftest subr-native-elisp-p ()
+ (should-not (subr-native-elisp-p (symbol-function 'identity))))
+
(ert-deftest subr-primitive-p ()
(should (subr-primitive-p (symbol-function 'identity))) ;function from fns.c
- (unless (fboundp 'subr-native-elisp-p)
+ (when (< emacs-major-version 28)
(should-not (subr-primitive-p (symbol-function 'match-string)))) ;function from subr.el
(should-not (subr-primitive-p (symbol-function 'defun))) ;macro from subr.el
(should-not (subr-primitive-p nil)))
diff --git a/compat.texi b/compat.texi
index 1948cda..6d0734f 100644
--- a/compat.texi
+++ b/compat.texi
@@ -1865,10 +1865,17 @@ long.
Return @code{t} if @var{object} is a primitive, built-in function. On
systems with native compilation @code{subrp} does not distinguish
between built-in functions and functions that have been compiled. If
-native compilation is not avaliable, this function behaves identically
+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/files.texi
@defun file-name-absolute-p filename
This function returns @code{t} if file @var{filename} is an absolute