[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/compat e9fae0ff26 4/4: compat-28: Add subr-native-elisp
From: |
ELPA Syncer |
Subject: |
[elpa] externals/compat e9fae0ff26 4/4: compat-28: Add subr-native-elisp-p |
Date: |
Sun, 15 Jan 2023 00:57:33 -0500 (EST) |
branch: externals/compat
commit e9fae0ff26db7140411cb3d039a88902a0dc6ea3
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>
compat-28: Add subr-native-elisp-p
---
NEWS.org | 1 +
compat-28.el | 4 ++++
compat-tests.el | 5 ++++-
compat.texi | 9 ++++++++-
4 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/NEWS.org b/NEWS.org
index 07e378dc48..f8f83c957a 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 6a5b035b2a..e97028c286 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 f4b99337e9..5d7423e91a 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 1948cdafa2..6d0734f866 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