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

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

[elpa] externals/compat 9a36f4bb06 2/4: compat-27: Add fixnump and bignu


From: ELPA Syncer
Subject: [elpa] externals/compat 9a36f4bb06 2/4: compat-27: Add fixnump and bignump
Date: Sun, 15 Jan 2023 00:57:33 -0500 (EST)

branch: externals/compat
commit 9a36f4bb061fd0a6bb3f8e848c50fbe5f75f68f3
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>

    compat-27: Add fixnump and bignump
---
 compat-27.el    |  3 +++
 compat-tests.el | 12 ++++++++++++
 compat.texi     | 14 ++++++++++++++
 3 files changed, 29 insertions(+)

diff --git a/compat-27.el b/compat-27.el
index 0210b73ae0..ec19a59e41 100644
--- a/compat-27.el
+++ b/compat-27.el
@@ -164,6 +164,9 @@ where USER is a valid login name."
 
 ;;;; Defined in subr.el
 
+(compat-defalias fixnump integerp) ;; <OK>
+(compat-defalias bignump ignore) ;; <OK>
+
 (compat-defmacro setq-local (&rest pairs) ;; <OK>
   "Handle multiple assignments."
   :explicit t
diff --git a/compat-tests.el b/compat-tests.el
index 7e0ee1838a..f4b99337e9 100644
--- a/compat-tests.el
+++ b/compat-tests.el
@@ -64,6 +64,18 @@
     (setq list (funcall sym list "first" 1 #'string=))
     (should (eq (compat-call plist-get list "first" #'string=) 1))))
 
+(ert-deftest fixnump ()
+  (should (fixnump 0))
+  (should (fixnump most-negative-fixnum))
+  (should (fixnump most-positive-fixnum)))
+
+(ert-deftest bignump ()
+  (should-not (bignump 0))
+  (should-not (bignump most-negative-fixnum))
+  (should-not (bignump most-positive-fixnum))
+  (should-equal (bignump (1+ most-positive-fixnum)) (> emacs-major-version 26))
+  (should-equal (bignump (1- most-negative-fixnum)) (> emacs-major-version 
26)))
+
 (ert-deftest buttonize ()
   (let ((b (buttonize "button" 'c 'd 'h)))
     (should-equal b "button")
diff --git a/compat.texi b/compat.texi
index 2e3e9fbfa1..1948cdafa2 100644
--- a/compat.texi
+++ b/compat.texi
@@ -859,6 +859,20 @@ The function @code{window-swap-states}.
 The following functions and macros implemented in 27.1, and are provided
 by Compat:
 
+@c copied from lispref/numbers.texi
+@defun bignump object
+This predicate tests whether its argument is a large integer, and
+returns @code{t} if so, @code{nil} otherwise.  Unlike small integers,
+large integers can be @code{=} or @code{eql} even if they are not @code{eq}.
+@end defun
+
+@c copied from lispref/numbers.texi
+@defun fixnump object
+This predicate tests whether its argument is a small integer, and
+returns @code{t} if so, @code{nil} otherwise.  Small integers can be
+compared with @code{eq}.
+@end defun
+
 @c copied from lispref/lists.texi
 @defun proper-list-p object
 This function returns the length of @var{object} if it is a proper list,



reply via email to

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