Prefer plusp/minusp to cl-plusp/cl-minusp

* lisp/dired.el (dired--move-to-next-line):
* lisp/emacs-lisp/ert.el (ert-run-tests-batch, ert-face-for-stats):
* lisp/emacs-lisp/pp.el (pp--format-definition):
* lisp/gnus/gnus-icalendar.el (gnus-icalendar-event--org-timestamp):
* lisp/ibuffer.el (ibuffer-compile-format, ibuffer--format-title)
(ibuffer--format-summary):
* lisp/image-mode.el (image-transform-set-percent):
* lisp/international/emoji.el (emoji--list-generate, emoji--read-emoji):
* lisp/progmodes/ebrowse.el (ebrowse-set-tree-indentation)
(ebrowse-set-member-buffer-column-width)
(ebrowse-cyclic-display-next/previous-member-list)
(ebrowse-draw-member-short-fn)
(ebrowse-switch-member-buffer-to-sibling-class, ebrowse-push-position):
* lisp/textmodes/dns-mode.el (dns-mode-reverse-and-expand-ipv6):
* test/lisp/emacs-lisp/bytecomp-tests.el
(bytecomp-tests--not-writable-directory)
(bytecomp-tests--dest-mountpoint)
(bytecomp-tests--target-file-no-directory):
* test/lisp/emacs-lisp/cl-seq-tests.el (cl-member-if-test)
(cl-member-if-not-test, cl-assoc-if-not-test, cl-rassoc-if-test)
(cl-rassoc-if-not-test):
* test/src/emacs-module-tests.el (mod-test-add-nanosecond/valid):
Prefer plusp and minusp to cl-plusp and cl-minusp.
This commit is contained in:
Stefan Kangas 2025-02-17 22:04:41 +01:00
parent afbf932106
commit 83bc811f7f
12 changed files with 35 additions and 34 deletions

View file

@ -2914,7 +2914,7 @@ is controlled by `dired-movement-style'."
(dired-move-to-filename) (dired-move-to-filename)
(point))) (point)))
;; Up/Down indicates the direction. ;; Up/Down indicates the direction.
(moving-down (if (cl-plusp arg) (moving-down (if (plusp arg)
1 ; means Down. 1 ; means Down.
-1))) ; means Up. -1))) ; means Up.
;; Line by line in case we forget to skip empty lines. ;; Line by line in case we forget to skip empty lines.
@ -2930,7 +2930,7 @@ is controlled by `dired-movement-style'."
;; means infinite loop with no files found. ;; means infinite loop with no files found.
(if (and wrapped (eq old-arg arg)) (if (and wrapped (eq old-arg arg))
(setq arg 0) (setq arg 0)
(goto-char (if (cl-plusp moving-down) (goto-char (if (plusp moving-down)
(point-min) (point-min)
(point-max)))) (point-max))))
(setq wrapped t)) (setq wrapped t))

View file

@ -1419,7 +1419,7 @@ Returns the stats object."
(message "%9s %S%s" (message "%9s %S%s"
(ert-string-for-test-result result nil) (ert-string-for-test-result result nil)
(ert-test-name test) (ert-test-name test)
(if (cl-plusp (if (plusp
(length (getenv "EMACS_TEST_VERBOSE"))) (length (getenv "EMACS_TEST_VERBOSE")))
(ert-reason-for-test-result result) (ert-reason-for-test-result result)
"")))) ""))))
@ -1432,7 +1432,7 @@ Returns the stats object."
(message "%9s %S%s" (message "%9s %S%s"
(ert-string-for-test-result result nil) (ert-string-for-test-result result nil)
(ert-test-name test) (ert-test-name test)
(if (cl-plusp (if (plusp
(length (getenv "EMACS_TEST_VERBOSE"))) (length (getenv "EMACS_TEST_VERBOSE")))
(ert-reason-for-test-result result) (ert-reason-for-test-result result)
"")))) ""))))
@ -2123,7 +2123,7 @@ non-nil, returns the face for expected results.."
(defun ert-face-for-stats (stats) (defun ert-face-for-stats (stats)
"Return a face that represents STATS." "Return a face that represents STATS."
(cond ((ert--stats-aborted-p stats) 'nil) (cond ((ert--stats-aborted-p stats) 'nil)
((cl-plusp (ert-stats-completed-unexpected stats)) ((plusp (ert-stats-completed-unexpected stats))
(ert-face-for-test-result nil)) (ert-face-for-test-result nil))
((eql (ert-stats-completed-expected stats) (ert-stats-total stats)) ((eql (ert-stats-completed-expected stats) (ert-stats-total stats))
(ert-face-for-test-result t)) (ert-face-for-test-result t))

View file

@ -577,7 +577,7 @@ the bounds of a region containing Lisp code to pretty-print."
(insert ")"))) (insert ")")))
(defun pp--format-definition (sexp indent edebug) (defun pp--format-definition (sexp indent edebug)
(while (and (cl-plusp indent) (while (and (plusp indent)
sexp) sexp)
(insert " ") (insert " ")
;; We don't understand all the edebug specs. ;; We don't understand all the edebug specs.

View file

@ -510,7 +510,8 @@ Return nil for non-recurring EVENT."
;; A 0:0 - A .:. -> A 0:0-.:. (default 1) ;; A 0:0 - A .:. -> A 0:0-.:. (default 1)
;; A 0:0 - A+n .:. -> A - A+n .:. ;; A 0:0 - A+n .:. -> A - A+n .:.
((and start-at-midnight ((and start-at-midnight
(cl-plusp start-end-date-diff)) (format "<%s>--<%s %s>" start-date end-date end-time)) (plusp start-end-date-diff))
(format "<%s>--<%s %s>" start-date end-date end-time))
;; default ;; default
;; A .:. - A .:. -> A .:.-.:. ;; A .:. - A .:. -> A .:.-.:.
;; A .:. - B .:. ;; A .:. - B .:.

View file

@ -1504,7 +1504,7 @@ If point is on a group name, this function operates on that group."
(max (nth 2 form)) (max (nth 2 form))
(align (nth 3 form)) (align (nth 3 form))
(elide (nth 4 form))) (elide (nth 4 form)))
(let* ((from-end-p (when (cl-minusp min) (let* ((from-end-p (when (minusp min)
(setq min (- min)) (setq min (- min))
t)) t))
(letbindings nil) (letbindings nil)
@ -2055,7 +2055,7 @@ the value of point at the beginning of the line for that buffer."
element element
(pcase-let ((`(,sym ,min ,_max ,align) element)) (pcase-let ((`(,sym ,min ,_max ,align) element))
;; Ignore negative MIN, since the titles are left-aligned. ;; Ignore negative MIN, since the titles are left-aligned.
(when (cl-minusp min) (when (minusp min)
(setq min (- min))) (setq min (- min)))
(let* ((name (or (get sym 'ibuffer-column-name) (let* ((name (or (get sym 'ibuffer-column-name)
(error "Unknown column %s in ibuffer-formats" sym))) (error "Unknown column %s in ibuffer-formats" sym)))
@ -2080,7 +2080,7 @@ the value of point at the beginning of the line for that buffer."
(make-string (length element) ?\s) (make-string (length element) ?\s)
(pcase-let ((`(,sym ,min ,_max ,align) element)) (pcase-let ((`(,sym ,min ,_max ,align) element))
;; Ignore negative MIN, since the summaries are left-aligned. ;; Ignore negative MIN, since the summaries are left-aligned.
(when (cl-minusp min) (when (minusp min)
(setq min (- min))) (setq min (- min)))
(let* ((summary (let* ((summary
(if (get sym 'ibuffer-column-summarizer) (if (get sym 'ibuffer-column-summarizer)

View file

@ -1564,7 +1564,7 @@ The percentage is in relation to the original size of the image."
(interactive (list (read-number "Scale (% of original): " 100 (interactive (list (read-number "Scale (% of original): " 100
'read-number-history)) 'read-number-history))
image-mode) image-mode)
(unless (cl-plusp scale) (unless (plusp scale)
(error "Not a positive number: %s" scale)) (error "Not a positive number: %s" scale))
(setq image-transform-resize (/ scale 100.0)) (setq image-transform-resize (/ scale 100.0))
(image-toggle-display-image)) (image-toggle-display-image))

View file

@ -222,7 +222,7 @@ the name is not known."
(cl-loop for i from 0 (cl-loop for i from 0
for glyph in alist for glyph in alist
do do
(when (and (cl-plusp i) (when (and (plusp i)
(zerop (mod i width))) (zerop (mod i width)))
(insert "\n")) (insert "\n"))
(insert (insert
@ -680,7 +680,7 @@ We prefer the earliest unique letter."
""))) "")))
strings))))) strings)))))
nil t))) nil t)))
(if (cl-plusp (length name)) (if (plusp (length name))
(let ((glyph (if emoji-alternate-names (let ((glyph (if emoji-alternate-names
(cadr (split-string name "\t")) (cadr (split-string name "\t"))
(gethash name emoji--all-bases)))) (gethash name emoji--all-bases))))

View file

@ -1334,7 +1334,7 @@ Pop to member buffer if no prefix ARG, to tree buffer otherwise."
"Indentation" "Indentation"
(int-to-string ebrowse--indentation)) (int-to-string ebrowse--indentation))
nil nil ebrowse--indentation)))) nil nil ebrowse--indentation))))
(when (cl-plusp width) (when (plusp width)
(setq-local ebrowse--indentation width) (setq-local ebrowse--indentation width)
(ebrowse-redraw-tree)))) (ebrowse-redraw-tree))))
@ -2168,7 +2168,7 @@ The new width is read from the minibuffer."
ebrowse--decl-column ebrowse--decl-column
ebrowse--column-width)) ebrowse--column-width))
"): "))))) "): ")))))
(when (cl-plusp width) (when (plusp width)
(if ebrowse--long-display-flag (if ebrowse--long-display-flag
(setq ebrowse--decl-column width) (setq ebrowse--decl-column width)
(setq ebrowse--column-width width)) (setq ebrowse--column-width width))
@ -2209,11 +2209,11 @@ make one."
ebrowse--accessor ebrowse--accessor
#'eql))) #'eql)))
(setf ebrowse--accessor (setf ebrowse--accessor
(cond ((cl-plusp incr) (cond ((plusp incr)
(or (nth (1+ index) (or (nth (1+ index)
ebrowse-member-list-accessors) ebrowse-member-list-accessors)
(cl-first ebrowse-member-list-accessors))) (cl-first ebrowse-member-list-accessors)))
((cl-minusp incr) ((minusp incr)
(or (and (>= (cl-decf index) 0) (or (and (>= (cl-decf index) 0)
(nth index (nth index
ebrowse-member-list-accessors)) ebrowse-member-list-accessors))
@ -2693,7 +2693,7 @@ TREE is the class tree in which the members are found."
(when (>= i ebrowse--n-columns) (when (>= i ebrowse--n-columns)
(setf i 0) (setf i 0)
(insert "\n"))))) (insert "\n")))))
(when (cl-plusp i) (when (plusp i)
(insert "\n")) (insert "\n"))
(goto-char (point-min)))) (goto-char (point-min))))
@ -2863,7 +2863,7 @@ Prefix arg INC specifies which one."
(setq index (+ inc (seq-position containing-list (setq index (+ inc (seq-position containing-list
ebrowse--displayed-class ebrowse--displayed-class
#'eql))) #'eql)))
(cond ((cl-minusp index) (message "No previous class")) (cond ((minusp index) (message "No previous class"))
((null (nth index containing-list)) (message "No next class"))) ((null (nth index containing-list)) (message "No next class")))
(setq index (max 0 (min index (1- (length containing-list))))) (setq index (max 0 (min index (1- (length containing-list)))))
(setq cls (nth index containing-list)) (setq cls (nth index containing-list))
@ -3729,7 +3729,7 @@ Positions in buffers that have no file names are not saved."
(let ((too-much (- (length ebrowse-position-stack) (let ((too-much (- (length ebrowse-position-stack)
ebrowse-max-positions))) ebrowse-max-positions)))
;; Do not let the stack grow to infinity. ;; Do not let the stack grow to infinity.
(when (cl-plusp too-much) (when (plusp too-much)
(setq ebrowse-position-stack (setq ebrowse-position-stack
(butlast ebrowse-position-stack too-much))) (butlast ebrowse-position-stack too-much)))
;; Push the position. ;; Push the position.

View file

@ -325,7 +325,7 @@ See `dns-mode-ipv6-to-nibbles' for examples."
(string-to-number chunk 16))))) (string-to-number chunk 16)))))
(rev-address-nibbles (rev-address-nibbles
(nreverse (if (and prefix-length (nreverse (if (and prefix-length
(cl-minusp prefix-length)) (minusp prefix-length))
(substring expanded-address prefix-length-nibbles) (substring expanded-address prefix-length-nibbles)
(substring expanded-address 0 prefix-length-nibbles))))) (substring expanded-address 0 prefix-length-nibbles)))))
(with-temp-buffer (with-temp-buffer
@ -334,7 +334,7 @@ See `dns-mode-ipv6-to-nibbles' for examples."
(insert char) (insert char)
(insert ".")) (insert "."))
(if (and prefix-length (if (and prefix-length
(cl-minusp prefix-length)) (minusp prefix-length))
(delete-char -1) (delete-char -1)
(insert "ip6.arpa.")) (insert "ip6.arpa."))
(insert " ") (insert " ")

View file

@ -1704,8 +1704,8 @@ writable (Bug#44631)."
(set-file-modes directory #o500) (set-file-modes directory #o500)
(should (byte-compile-file input-file)) (should (byte-compile-file input-file))
(should (file-regular-p output-file)) (should (file-regular-p output-file))
(should (cl-plusp (file-attribute-size (should (plusp (file-attribute-size
(file-attributes output-file))))) (file-attributes output-file)))))
;; Allow the directory to be deleted. ;; Allow the directory to be deleted.
(set-file-modes directory #o777))))) (set-file-modes directory #o777)))))
@ -1757,8 +1757,8 @@ mountpoint (Bug#44631)."
(ert-fail `((status . ,status) (ert-fail `((status . ,status)
(output . ,(buffer-string))))))) (output . ,(buffer-string)))))))
(should (file-regular-p output-file)) (should (file-regular-p output-file))
(should (cl-plusp (file-attribute-size (should (plusp (file-attribute-size
(file-attributes output-file))))) (file-attributes output-file)))))
;; Allow the directory to be deleted. ;; Allow the directory to be deleted.
(set-file-modes directory #o777)))))) (set-file-modes directory #o777))))))
@ -1772,8 +1772,8 @@ mountpoint (Bug#44631)."
nil "test.el" nil nil nil 'excl) nil "test.el" nil nil nil 'excl)
(should (byte-compile-file "test.el")) (should (byte-compile-file "test.el"))
(should (file-regular-p "test.elc")) (should (file-regular-p "test.elc"))
(should (cl-plusp (file-attribute-size (should (plusp (file-attribute-size
(file-attributes "test.elc"))))))) (file-attributes "test.elc")))))))
(defun bytecomp-tests--get-vars () (defun bytecomp-tests--get-vars ()
(list (ignore-errors (symbol-value 'bytecomp-tests--var1)) (list (ignore-errors (symbol-value 'bytecomp-tests--var1))

View file

@ -645,7 +645,7 @@ Additionally register an `ert-info' to help identify test failures."
(should (equal result '(a a a a)))) (should (equal result '(a a a a))))
(let ((result (cl-member-if #'evenp '()))) (let ((result (cl-member-if #'evenp '())))
(should (equal result nil))) (should (equal result nil)))
(let ((result (cl-member-if #'cl-minusp '(1 2 3 4 5)))) (let ((result (cl-member-if #'minusp '(1 2 3 4 5))))
(should (equal result nil))) (should (equal result nil)))
(let ((result (cl-member-if (lambda (x) (and (numberp x) (<= x 2))) (let ((result (cl-member-if (lambda (x) (and (numberp x) (<= x 2)))
'(1 "two" 3 0)))) '(1 "two" 3 0))))
@ -672,7 +672,7 @@ Additionally register an `ert-info' to help identify test failures."
(should (equal result nil))) (should (equal result nil)))
(let ((result (cl-member-if-not (lambda (x) (eq x 'a)) '(a a a a)))) (let ((result (cl-member-if-not (lambda (x) (eq x 'a)) '(a a a a))))
(should (equal result nil))) (should (equal result nil)))
(let ((result (cl-member-if-not #'cl-minusp '(1 2 3 4 5)))) (let ((result (cl-member-if-not #'minusp '(1 2 3 4 5))))
(should (equal result '(1 2 3 4 5)))) (should (equal result '(1 2 3 4 5))))
(let ((result (cl-member-if-not (let ((result (cl-member-if-not
(lambda (x) (or (numberp x) (stringp x) (eq x 'b))) (lambda (x) (or (numberp x) (stringp x) (eq x 'b)))
@ -734,7 +734,7 @@ Additionally register an `ert-info' to help identify test failures."
(let* ((alist '((1 . "odd") (2 . "even") (3 . "odd") (4 . "even"))) (let* ((alist '((1 . "odd") (2 . "even") (3 . "odd") (4 . "even")))
(result (cl-assoc-if-not #'evenp alist))) (result (cl-assoc-if-not #'evenp alist)))
(should (equal result '(1 . "odd")))) (should (equal result '(1 . "odd"))))
(let ((result (cl-assoc-if-not #'cl-plusp (let ((result (cl-assoc-if-not #'plusp
'((1 . "one") (2 . "two") (3 . "three"))))) '((1 . "one") (2 . "two") (3 . "three")))))
(should (equal result nil))) (should (equal result nil)))
(let ((result (cl-assoc-if-not (lambda (x) (< x 5)) (let ((result (cl-assoc-if-not (lambda (x) (< x 5))
@ -798,7 +798,7 @@ Additionally register an `ert-info' to help identify test failures."
(should (equal result '("one" . 1)))) (should (equal result '("one" . 1))))
(let ((result (cl-rassoc-if #'evenp '()))) (let ((result (cl-rassoc-if #'evenp '())))
(should (equal result nil))) (should (equal result nil)))
(let ((result (cl-rassoc-if #'cl-plusp (let ((result (cl-rassoc-if #'plusp
'(("first" . 1) ("second" . 2) ("third" . 3))))) '(("first" . 1) ("second" . 2) ("third" . 3)))))
(should (equal result '("first" . 1)))) (should (equal result '("first" . 1))))
(let ((result (cl-rassoc-if (lambda (x) (string= (number-to-string x) "two")) (let ((result (cl-rassoc-if (lambda (x) (string= (number-to-string x) "two"))
@ -812,7 +812,7 @@ Additionally register an `ert-info' to help identify test failures."
(let ((result (cl-rassoc-if-not #'evenp (let ((result (cl-rassoc-if-not #'evenp
'(("one" . 1) ("two" . 2) ("three" . 3))))) '(("one" . 1) ("two" . 2) ("three" . 3)))))
(should (equal result '("one" . 1)))) (should (equal result '("one" . 1))))
(let ((result (cl-rassoc-if-not #'cl-plusp (let ((result (cl-rassoc-if-not #'plusp
'(("one" . 1) ("two" . 2) ("three" . 3))))) '(("one" . 1) ("two" . 2) ("three" . 3)))))
(should (equal result nil))) (should (equal result nil)))
(let ((result (cl-rassoc-if-not (lambda (x) (< x 5)) (let ((result (cl-rassoc-if-not (lambda (x) (< x 5))

View file

@ -376,7 +376,7 @@ Interactively, you can try hitting \\[keyboard-quit] to quit."
(should (consp result)) (should (consp result))
(should (integerp (car result))) (should (integerp (car result)))
(should (integerp (cdr result))) (should (integerp (cdr result)))
(should (cl-plusp (cdr result))) (should (plusp (cdr result)))
(should (time-equal-p result desired-result)))))) (should (time-equal-p result desired-result))))))
(ert-deftest mod-test-add-nanosecond/nil () (ert-deftest mod-test-add-nanosecond/nil ()