* 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.
(cherry picked from commit
89bdb57f24e0bdc1a3d33d7124d93c9a1b45fa1d)
'(t))))
((not (equal n (car math-prime-test-cache)))
(cond ((if (consp n)
- (= (% (nth 1 n) 2) 0)
- (= (% n 2) 0))
+ (evenp (nth 1 n))
+ (evenp n))
'(nil 2))
((if (consp n)
(= (% (nth 1 n) 5) 0)
(if invhyp (calc-wrapper)) ; clear Inv and Hyp flags
(unwind-protect
(cond ((or (null cmd)
- (= (% row 2) 0))
+ (evenp row))
(beep))
((and (> (minibuffer-depth) 0))
(cond (isstring
(math-div (math-float num-sqrt) den-sqrt))))))
(and (eq (car-safe a) 'float)
(if calc-symbolic-mode
- (if (= (% (nth 2 a) 2) 0)
+ (if (evenp (nth 2 a))
(let ((res (cl-isqrt (nth 1 a))))
(if (= (* res res) (nth 1 a))
(math-make-float res (/ (nth 2 a) 2))
(t
(if (null guess)
(let ((ldiff (- (math-numdigs (nth 1 a)) 6)))
- (or (= (% (+ (nth 2 a) ldiff) 2) 0) (setq ldiff (1+ ldiff)))
+ (or (evenp (+ (nth 2 a) ldiff)) (setq ldiff (1+ ldiff)))
(setq guess (math-make-float (cl-isqrt
(math-scale-int (nth 1 a) (- ldiff)))
(/ (+ (nth 2 a) ldiff) 2)))))
(defun math-iipow (a n) ; [O O S]
(cond ((= n 0) 1)
((= n 1) a)
- ((= (% n 2) 0) (math-iipow (math-mul a a) (/ n 2)))
+ ((evenp n) (math-iipow (math-mul a a) (/ n 2)))
(t (math-mul a (math-iipow (math-mul a a) (/ n 2))))))
(defun math-iipow-show (a n) ; [O O S]
(let ((val (cond
((= n 0) 1)
((= n 1) a)
- ((= (% n 2) 0) (math-iipow-show (math-mul a a) (/ n 2)))
+ ((evenp n) (math-iipow-show (math-mul a a) (/ n 2)))
(t (math-mul a (math-iipow-show (math-mul a a) (/ n 2)))))))
(math-working "pow" val)
val))
(math-reject-arg (car p) 'anglep))
(setq p (cdr p)))
(setq flat (sort flat 'math-lessp))
- (if (= (% len 2) 0)
+ (if (evenp len)
(math-div (math-add (nth (1- hlen) flat) (nth hlen flat)) 2)
(nth hlen flat))))))
(cal-tex-b-document)
(cal-tex-cmd "\\pagestyle" "empty")
(dotimes (i n)
- (if (zerop (mod i 2))
+ (if (evenp i)
(insert "\\righthead")
(insert "\\lefthead"))
(cal-tex-arg
(calendar-extract-year d))))))
(insert "%\n")
(dotimes (_jdummy 7)
- (if (zerop (mod i 2))
+ (if (evenp i)
(insert "\\rightday")
(insert "\\leftday"))
(cal-tex-arg (cal-tex-LaTeXify-string (calendar-day-name date)))
(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.
(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)))
(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)))
(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)))
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
(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))
\(fn [VARIABLE VALUE]...)"
(declare (debug setq))
- (unless (zerop (mod (length pairs) 2))
+ (unless (evenp (length pairs))
(error "PAIRS must have an even number of variable/value members"))
(let ((set-expr nil)
(profile-vars nil))
(make-string minlen ?-)
file-name i parts
(make-string
- (if (= 0 (% whole-len 2)) (1- minlen) minlen) ?-)))
+ (if (evenp whole-len) (1- minlen) minlen) ?-)))
(goto-char (point-min))
(when (re-search-forward "^Subject: " nil t)
(max (cond ((= month 2)
(if (date-leap-year-p year) 29 28))
((<= month 7)
- (if (zerop (% month 2)) 30 31))
+ (if (evenp month) 30 31))
(t
- (if (zerop (% month 2)) 31 30))))
+ (if (evenp month) 31 30))))
(doms dom-list)
(dows dow-list)
day days)
(max (cond ((= month 2)
(if (date-leap-year-p year) 29 28))
((<= month 7)
- (if (zerop (% month 2)) 30 31))
+ (if (evenp month) 30 31))
(t
- (if (zerop (% month 2)) 31 30))))
+ (if (evenp month) 31 30))))
(doms dom-list)
(dows dow-list)
day days)
(forward-char (+ 1 (/ (1+ 5x5-x-scale) 2)))
(dotimes (x 5x5-grid-size)
(when (5x5-cell solution-grid y x)
- (if (= 0 (mod 5x5-x-scale 2))
+ (if (evenp 5x5-x-scale)
(progn
(insert "()")
(delete-region (point) (+ (point) 2))
;; be either a leaf child, or a subheading.
(let ((running gametree-default-score)
(minmax
- (if (= 0 (mod (gametree-current-branch-ply) 2))
+ (if (evenp (gametree-current-branch-ply))
'max 'min)))
(while (and (not (eobp))
(= 0 (gametree-current-branch-depth))) ;handle leaves
(gametree-current-branch-ply)))))
(goto-char (1- (point)))
(insert "\n")
- (insert (format (if (= 0 (mod starting-plies 2))
+ (insert (format (if (evenp starting-plies)
gametree-full-ply-format
gametree-half-ply-format)
(/ starting-plies 2))))))
gametree-full-ply-regexp "\\|"
gametree-half-ply-regexp "\\)")))
(progn
- (insert (format (if (= 0 (mod (gametree-looking-at-ply) 2))
+ (insert (format (if (evenp (gametree-looking-at-ply))
gametree-full-ply-format
gametree-half-ply-format)
(/ (gametree-looking-at-ply) 2)))
(dotimes (i 20)
(goto-char pos)
(delete-char 1)
- (insert (if (= 0 (% i 2)) hmm c-string))
+ (insert (if (evenp i) hmm c-string))
(zone-park/sit-for wbeg (setq wait (* wait 0.8))))
(delete-char -1) (insert c-string)))
(cond ((ediff-buffer-live-p patch-buf))
;; even prefix arg: patch in buffer
- ((and (integerp arg) (eq 0 (mod arg 2)))
+ ((and (integerp arg) (evenp arg))
(setq patch-buf (ediff-prompt-for-patch-buffer)))
;; odd prefix arg: get patch from a file
((and (integerp arg) (oddp arg))
data)))
(defun yank-media--utf-16-p (data)
- (and (zerop (mod (length data) 2))
+ (and (evenp (length data))
(let ((stats (vector 0 0)))
(dotimes (i (length data))
(when (zerop (elt data i))