diff options
author | Stefan Kangas <stefankangas@gmail.com> | 2025-02-17 05:06:20 +0100 |
---|---|---|
committer | Stefan Kangas <stefankangas@gmail.com> | 2025-02-17 05:37:10 +0100 |
commit | e373a6e0d30c28045a0f33e662933c2c2660a220 (patch) | |
tree | 519676503598099a659d1f443a3d2f99a593842f /lisp/emacs-lisp | |
parent | 5ce746c3b0fa3a0b73796182960ff06cf3f31473 (diff) | |
download | emacs-e373a6e0d30c28045a0f33e662933c2c2660a220.tar.gz emacs-e373a6e0d30c28045a0f33e662933c2c2660a220.tar.bz2 emacs-e373a6e0d30c28045a0f33e662933c2c2660a220.zip |
Prefer '(oddp A)' to '(= 1 (% A 2))'
* lisp/align.el (align-match-tex-pattern):
* lisp/calc/calc-funcs.el (math-bernoulli-number):
* lisp/cedet/semantic/bovine/el.el (semantic-ctxt-current-assignment):
* lisp/comint.el (comint-within-quotes):
* lisp/emacs-lisp/chart.el (chart-axis-draw):
* lisp/emacs-lisp/cl-extra.el (cl-round):
* lisp/emacs-lisp/eieio.el (defclass):
* lisp/emacs-lisp/elint.el (elint-check-setq-form):
* lisp/emulation/cua-rect.el (cua--rectangle-right-side):
* lisp/progmodes/gud.el (gud-gdb-completions-1):
* lisp/ps-print.el (ps-end-job):
* lisp/ses.el (ses-center):
* lisp/vc/ediff-ptch.el (ediff-get-patch-buffer): Prefer '(oddp A)' to
'(= 1 (% A 2))' and variations thereof.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r-- | lisp/emacs-lisp/chart.el | 2 | ||||
-rw-r--r-- | lisp/emacs-lisp/cl-extra.el | 2 | ||||
-rw-r--r-- | lisp/emacs-lisp/eieio.el | 2 | ||||
-rw-r--r-- | lisp/emacs-lisp/elint.el | 2 |
4 files changed, 4 insertions, 4 deletions
diff --git a/lisp/emacs-lisp/chart.el b/lisp/emacs-lisp/chart.el index 6f2f85fc765..2a01501f99e 100644 --- a/lisp/emacs-lisp/chart.el +++ b/lisp/emacs-lisp/chart.el @@ -347,7 +347,7 @@ of the drawing." (odd nil) p1) (while s - (setq odd (= (% (length s) 2) 1)) + (setq odd (oddp (length s))) (setq r (chart-translate-namezone (oref a chart) i)) (if (eq dir 'vertical) (setq p (/ (+ (car r) (cdr r)) 2)) diff --git a/lisp/emacs-lisp/cl-extra.el b/lisp/emacs-lisp/cl-extra.el index 09470457d93..ab06682cf93 100644 --- a/lisp/emacs-lisp/cl-extra.el +++ b/lisp/emacs-lisp/cl-extra.el @@ -392,7 +392,7 @@ With two arguments, return rounding and remainder of their quotient." (res (cl-floor (+ x hy) y))) (if (and (= (car (cdr res)) 0) (= (+ hy hy) y) - (/= (% (car res) 2) 0)) + (oddp (car res))) (list (1- (car res)) hy) (list (car res) (- (car (cdr res)) hy)))) (let ((q (round (/ x y)))) diff --git a/lisp/emacs-lisp/eieio.el b/lisp/emacs-lisp/eieio.el index 1fa177b08da..8665934ebfd 100644 --- a/lisp/emacs-lisp/eieio.el +++ b/lisp/emacs-lisp/eieio.el @@ -118,7 +118,7 @@ and reference them using the function `class-option'." (/= 1 (% (length options-and-doc) 2))) (error "Too many arguments to `defclass'")) ((and (symbolp (car options-and-doc)) - (/= 0 (% (length options-and-doc) 2))) + (oddp (length options-and-doc))) (error "Too many arguments to `defclass'"))) (if (stringp (car options-and-doc)) diff --git a/lisp/emacs-lisp/elint.el b/lisp/emacs-lisp/elint.el index 0f5d15be838..b63bcd44edf 100644 --- a/lisp/emacs-lisp/elint.el +++ b/lisp/emacs-lisp/elint.el @@ -798,7 +798,7 @@ CODE can be a lambda expression, a macro, or byte-compiled code." (defun elint-check-setq-form (form env) "Lint the setq FORM in ENV." - (or (= (mod (length form) 2) 1) + (or (oddp (length form)) ;; (setq foo) is valid and equivalent to (setq foo nil). (elint-warning "Missing value in setq: %s" form)) (let ((newenv env) |