emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/compat 54413f82c4: Add subr-primitive-p defined in Emac


From: ELPA Syncer
Subject: [elpa] externals/compat 54413f82c4: Add subr-primitive-p defined in Emacs 28
Date: Fri, 15 Jul 2022 07:57:23 -0400 (EDT)

branch: externals/compat
commit 54413f82c44579eccd1771e0f9f83ecf7df3b896
Author: Philip Kaludercic <philipk@posteo.net>
Commit: Philip Kaludercic <philipk@posteo.net>

    Add subr-primitive-p defined in Emacs 28
---
 MANUAL          | 1 +
 compat-28.el    | 8 ++++++++
 compat-tests.el | 6 ++++++
 compat.texi     | 4 ++++
 4 files changed, 19 insertions(+)

diff --git a/MANUAL b/MANUAL
index f33adb1dcd..35af1b52ea 100644
--- a/MANUAL
+++ b/MANUAL
@@ -449,6 +449,7 @@ provided by Compat by default:
 - Function: make-lock-file-name :: Defined in ~files.el~.
 - Function: null-device :: Defined in ~files.el~.
 - Function: decoded-time-period :: Defined in ~time-data.el~.
+- Function: subr-primitive-p :: Defined in ~subr.el~.
 
 These functions are prefixed with ~compat~ prefix, and are only loaded
 when ~compat-28~ is required:
diff --git a/compat-28.el b/compat-28.el
index 89c24c2f52..c7e03eca83 100644
--- a/compat-28.el
+++ b/compat-28.el
@@ -447,6 +447,14 @@ not a list, return a one-element list containing OBJECT."
       object
     (list object)))
 
+
+(declare-function subr-native-elisp-p nil (object))
+(compat-defun subr-primitive-p (object)
+  "Return t if OBJECT is a built-in primitive function."
+  (and (subrp object)
+       (not (and (fboundp 'subr-native-elisp-p)
+                (subr-native-elisp-p object)))))
+
 ;;;; Defined in subr-x.el
 
 (compat-defun string-clean-whitespace (string)
diff --git a/compat-tests.el b/compat-tests.el
index e762eefdf2..51063c6641 100644
--- a/compat-tests.el
+++ b/compat-tests.el
@@ -1771,5 +1771,11 @@ being compared against."
   (expect wrong-type-argument '(0 0 0 0 a))
   (expect wrong-type-argument '(0 0 0 0 0 a)))
 
+(compat-deftest subr-primitive-p
+  (ought t (symbol-function 'identity))       ;function from fns.c
+  (ought nil (symbol-function 'match-string)) ;function from subr.el
+  (ought nil (symbol-function 'defun))        ;macro from subr.el
+  (ought nil nil))
+
 (provide 'compat-tests)
 ;;; compat-tests.el ends here
diff --git a/compat.texi b/compat.texi
index 471d64e7a9..51230ebc26 100644
--- a/compat.texi
+++ b/compat.texi
@@ -1017,6 +1017,10 @@ Defined in @code{files.el}.
 Defined in @code{time-data.el}.
 @end defun
 
+@defun subr-primitive-p
+Defined in @code{subr.el}.
+@end defun
+
 These functions are prefixed with @code{compat} prefix, and are only loaded
 when @code{compat-28} is required:
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]