diff options
author | Stefan Kangas <stefankangas@gmail.com> | 2025-02-17 05:10:33 +0100 |
---|---|---|
committer | Stefan Kangas <stefankangas@gmail.com> | 2025-02-17 05:37:10 +0100 |
commit | 89bdb57f24e0bdc1a3d33d7124d93c9a1b45fa1d (patch) | |
tree | 29d2630e32a5bdda3cfdce44ba0a682c8cea3da2 /lisp/emacs-lisp | |
parent | e373a6e0d30c28045a0f33e662933c2c2660a220 (diff) | |
download | emacs-89bdb57f24e0bdc1a3d33d7124d93c9a1b45fa1d.tar.gz emacs-89bdb57f24e0bdc1a3d33d7124d93c9a1b45fa1d.tar.bz2 emacs-89bdb57f24e0bdc1a3d33d7124d93c9a1b45fa1d.zip |
Prefer '(evenp A)' to '(= 0 (% A 2))'
* lisp/calc/calc-comb.el (math-prime-test):
* lisp/calc/calc-keypd.el (calc-keypad-press):
* lisp/calc/calc-math.el (math-sqrt):
(math-sqrt-raw):
* lisp/calc/calc-misc.el (math-iipow):
(math-iipow-show):
* lisp/calc/calc-stat.el (calcFunc-vmedian):
* lisp/calendar/cal-tex.el (cal-tex-cursor-filofax-2week):
(cal-tex-cursor-filofax-daily):
* lisp/elec-pair.el (electric-pair-post-self-insert-function):
* lisp/emacs-lisp/checkdoc.el (checkdoc-in-example-string-p):
* lisp/emacs-lisp/eieio.el (defclass):
* lisp/emacs-lisp/ert-x.el (ert-propertized-string):
* lisp/emacs-lisp/ert.el (ert--significant-plist-keys):
(ert--plist-difference-explanation):
* lisp/emacs-lisp/helper.el (Helper-help-scroller):
* lisp/emacs-lisp/pcase.el (pcase-setq):
* lisp/files-x.el (setq-connection-local):
* lisp/gnus/gnus-uu.el (gnus-uu-post-encoded):
* lisp/gnus/message.el (message-make-in-reply-to):
* lisp/gnus/nndiary.el (nndiary-last-occurrence):
(nndiary-next-occurrence):
* lisp/mail/rfc2047.el (rfc2047-decode-region):
* lisp/play/5x5.el (5x5-draw-grid):
* lisp/play/gametree.el (gametree-compute-reduced-score):
(gametree-insert-new-leaf):
(gametree-break-line-here):
* lisp/play/zone.el (zone-fret):
* lisp/vc/ediff-ptch.el (ediff-get-patch-buffer):
* lisp/yank-media.el (yank-media--utf-16-p): Prefer '(evenp A)' to
'(= 0 (% A 2))' and variations thereof.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r-- | lisp/emacs-lisp/checkdoc.el | 2 | ||||
-rw-r--r-- | lisp/emacs-lisp/eieio.el | 2 | ||||
-rw-r--r-- | lisp/emacs-lisp/ert-x.el | 2 | ||||
-rw-r--r-- | lisp/emacs-lisp/ert.el | 6 | ||||
-rw-r--r-- | lisp/emacs-lisp/helper.el | 2 | ||||
-rw-r--r-- | lisp/emacs-lisp/pcase.el | 2 |
6 files changed, 8 insertions, 8 deletions
diff --git a/lisp/emacs-lisp/checkdoc.el b/lisp/emacs-lisp/checkdoc.el index dd3da9ae8c0..3541e3d0a57 100644 --- a/lisp/emacs-lisp/checkdoc.el +++ b/lisp/emacs-lisp/checkdoc.el @@ -2109,7 +2109,7 @@ The text checked is between START and LIMIT." (goto-char start) (while (and (< (point) p) (re-search-forward "\\\\\"" limit t)) (setq c (1+ c))) - (and (< 0 c) (= (% c 2) 0)))))) + (and (< 0 c) (evenp c)))))) (defun checkdoc-in-abbreviation-p (begin) "Return non-nil if point is at an abbreviation. diff --git a/lisp/emacs-lisp/eieio.el b/lisp/emacs-lisp/eieio.el index 8665934ebfd..0f029813f80 100644 --- a/lisp/emacs-lisp/eieio.el +++ b/lisp/emacs-lisp/eieio.el @@ -115,7 +115,7 @@ and reference them using the function `class-option'." (cl-check-type superclasses list) (cond ((and (stringp (car options-and-doc)) - (/= 1 (% (length options-and-doc) 2))) + (evenp (length options-and-doc))) (error "Too many arguments to `defclass'")) ((and (symbolp (car options-and-doc)) (oddp (length options-and-doc))) diff --git a/lisp/emacs-lisp/ert-x.el b/lisp/emacs-lisp/ert-x.el index 147787d3d38..0dacec130a0 100644 --- a/lisp/emacs-lisp/ert-x.el +++ b/lisp/emacs-lisp/ert-x.el @@ -260,7 +260,7 @@ structure with the plists in ARGS." (string (let ((begin (point))) (insert x) (set-text-properties begin (point) current-plist))) - (list (unless (zerop (mod (length x) 2)) + (list (unless (evenp (length x)) (error "Odd number of args in plist: %S" x)) (setq current-plist x)))) (buffer-string))) diff --git a/lisp/emacs-lisp/ert.el b/lisp/emacs-lisp/ert.el index 5d1b9f2acbb..e8012326eb3 100644 --- a/lisp/emacs-lisp/ert.el +++ b/lisp/emacs-lisp/ert.el @@ -576,7 +576,7 @@ Return nil if they are." (defun ert--significant-plist-keys (plist) "Return the keys of PLIST that have non-null values, in order." - (cl-assert (zerop (mod (length plist) 2)) t) + (cl-assert (evenp (length plist)) t) (cl-loop for (key value . rest) on plist by #'cddr unless (or (null value) (memq key accu)) collect key into accu finally (cl-return accu))) @@ -587,8 +587,8 @@ Return nil if they are." Returns nil if they are equivalent, i.e., have the same value for each key, where absent values are treated as nil. The order of key/value pairs in each list does not matter." - (cl-assert (zerop (mod (length a) 2)) t) - (cl-assert (zerop (mod (length b) 2)) t) + (cl-assert (evenp (length a)) t) + (cl-assert (evenp (length b)) t) ;; Normalizing the plists would be another way to do this but it ;; requires a total ordering on all lisp objects (since any object ;; is valid as a text property key). Perhaps defining such an diff --git a/lisp/emacs-lisp/helper.el b/lisp/emacs-lisp/helper.el index d8f758d2fe5..8a173219545 100644 --- a/lisp/emacs-lisp/helper.el +++ b/lisp/emacs-lisp/helper.el @@ -80,7 +80,7 @@ (recenter)) ((and (or (eq continue 'backspace) (eq continue ?\177)) - (zerop (% state 2))) + (evenp state)) (scroll-down)) (t (setq continue nil)))))))) diff --git a/lisp/emacs-lisp/pcase.el b/lisp/emacs-lisp/pcase.el index a6a4751f49a..c68b8961ee3 100644 --- a/lisp/emacs-lisp/pcase.el +++ b/lisp/emacs-lisp/pcase.el @@ -370,7 +370,7 @@ undetected, binding variables to arbitrary values, such as nil. (cond (args (let ((arg-length (length args))) - (unless (= 0 (mod arg-length 2)) + (unless (evenp arg-length) (signal 'wrong-number-of-arguments (list 'pcase-setq (+ 2 arg-length))))) (let ((result)) |