New functions plusp and minusp

* lisp/emacs-lisp/cl-lib.el (cl-plusp, cl-minusp): Move from here...
* lisp/subr.el (plusp, minusp): ...to here.  Make old names into
aliases, documented as deprecated.  Add type declarations.  Change from
defsubst to regular functions with compiler macros.
* lisp/obsolete/cl.el: Don't alias plusp and minusp.

* test/lisp/emacs-lisp/cl-lib-tests.el (cl-lib-test-plusp)
(cl-lib-test-minusp): Move tests from here...
* test/lisp/subr-tests.el (subr-test-plusp, subr-test-minusp):
...to here.

* doc/lispref/numbers.texi (Predicates on Numbers): Document plusp
and minusp.
* doc/misc/cl.texi (Predicates on Numbers): Delete cl-plusp and
cl-minusp.
* lisp/emacs-lisp/shortdoc.el (number): Document plusp and minusp
instead of cl-plusp and cl-minusp.
This commit is contained in:
Stefan Kangas 2025-02-17 21:58:53 +01:00
parent 1d27028df8
commit afbf932106
9 changed files with 80 additions and 59 deletions

View file

@ -270,15 +270,17 @@ so that they are registered at compile-time as well as run-time."
(define-obsolete-function-alias 'cl-floatp-safe 'floatp "24.4")
(defsubst cl-plusp (number)
"Return t if NUMBER is positive."
(declare (side-effect-free t))
(> number 0))
(defalias 'cl-plusp #'plusp
"Return t if NUMBER is positive.
(defsubst cl-minusp (number)
"Return t if NUMBER is negative."
(declare (side-effect-free t))
(< number 0))
This function is considered deprecated in favor of the built-in function
`plusp' that was added in Emacs 31.1.")
(defalias 'cl-minusp #'minusp
"Return t if NUMBER is negative.
This function is considered deprecated in favor of the built-in function
`minusp' that was added in Emacs 31.1.")
(defalias 'cl-oddp #'oddp
"Return t if INTEGER is odd.

View file

@ -1412,12 +1412,12 @@ A FUNC form can have any number of `:no-eval' (or `:no-value'),
:eval (natnump -1)
:eval (natnump 0)
:eval (natnump 23))
(cl-plusp
:eval (cl-plusp 0)
:eval (cl-plusp 1))
(cl-minusp
:eval (cl-minusp 0)
:eval (cl-minusp -1))
(plusp
:eval (plusp 0)
:eval (plusp 1))
(minusp
:eval (minusp 0)
:eval (minusp -1))
(oddp
:eval (oddp 3))
(evenp