]> git.eshelyaron.com Git - emacs.git/commitdiff
Prefer cl-evenp/cl-oddp in some places
authorStefan Kangas <stefankangas@gmail.com>
Mon, 17 Feb 2025 00:57:22 +0000 (01:57 +0100)
committerEshel Yaron <me@eshelyaron.com>
Tue, 18 Feb 2025 08:45:16 +0000 (09:45 +0100)
* lisp/erc/erc.el (erc-format-message):
* lisp/obsolete/thumbs.el (thumbs-emboss-image):
* lisp/org/org-capture.el (org-capture-escaped-%):
* lisp/org/org-element-ast.el (org-element-create):
* lisp/org/org-macro.el (org-macro-extract-arguments):
* lisp/org/org-persist.el (org-persist--get-collection):
* lisp/org/ox-odt.el (org-odt-get-table-cell-styles):
* lisp/org/ox.el (org-export--dispatch-ui):
* lisp/progmodes/cperl-mode.el (cperl-forward-re)
(cperl-find-pods-heres): Prefer 'cl-evenp/'cl-oddp' to free-coding them
in some files that already depend on cl-lib in run-time.

(cherry picked from commit 9efd11e5fd4324fb1686b802c15ae36046b0939a)

lisp/obsolete/thumbs.el
lisp/org/org-capture.el
lisp/org/org-element-ast.el
lisp/org/org-macro.el
lisp/org/org-persist.el
lisp/org/ox-odt.el
lisp/org/ox.el
lisp/progmodes/cperl-mode.el

index 582bb7f0cafa25ea0c5c62635af7565605d6c1d9..a4f28ce97c54a67043b627d74a95c2062a64d065 100644 (file)
@@ -628,7 +628,7 @@ ACTION and ARG should be a valid convert command."
 (defun thumbs-emboss-image (emboss)
   "Emboss the image with value EMBOSS."
   (interactive "nEmboss value: ")
-  (if (or (< emboss 3) (> emboss 31) (zerop (% emboss 2)))
+  (if (or (< emboss 3) (> emboss 31) (cl-evenp emboss))
       (error "Arg must be an odd number between 3 and 31"))
   (thumbs-modify-image "emboss" (number-to-string emboss)))
 
index 0720ad53cc79bd039bd32482591c70d01eae3bc4..d4ae0207c365bc8daed7fb3a61a2e0141dd027c9 100644 (file)
@@ -1920,7 +1920,7 @@ placeholder to check."
     (goto-char (match-beginning 0))
     (let ((n (abs (skip-chars-backward "\\\\"))))
       (delete-char (/ (1+ n) 2))
-      (= (% n 2) 1))))
+      (cl-oddp n))))
 
 (defun org-capture-expand-embedded-elisp (&optional mark)
   "Evaluate embedded elisp %(sexp) and replace with the result.
index d4473cf4024f9fb431a40ddc19e1510f6420489f..5e1a93a2417d67b40e3d2dcbf1a6597255c1c8c8 100644 (file)
@@ -738,7 +738,7 @@ string.  Alternatively, TYPE can be a string.  When TYPE is nil or
   (cl-assert
    ;; FIXME: Just use `plistp' from Emacs 29 when available.
    (let ((len (proper-list-p props)))
-     (and len (zerop (% len 2)))))
+     (and len (cl-evenp len))))
   ;; Assign parray.
   (when (and props (not (stringp type)) (not (eq type 'plain-text)))
     (let ((node (list 'dummy props)))
index 66ae4d7af68c772e1a45346f2d3c4b1dfba93b58..500dfbc545de27b9cd77d9f8dfd6233919b291f7 100644 (file)
@@ -329,7 +329,7 @@ Return a list of arguments, as strings.  This is the opposite of
     (lambda (str)
       (let ((len (length (match-string 1 str))))
        (concat (make-string (/ len 2) ?\\)
-               (if (zerop (mod len 2)) "\000" ","))))
+               (if (cl-evenp len) "\000" ","))))
     s nil t)
    "\000"))
 
index deab2544cbd7106e79c8557e838a4035992b329d..aed8ebfcc051a5e04b2eb63d555b5c95e48f53f7 100644 (file)
@@ -594,7 +594,7 @@ MISC, if non-nil will be appended to the collection.  It must be a plist."
   (unless (and (listp container) (listp (car container)))
     (setq container (list container)))
   (setq associated (org-persist--normalize-associated associated))
-  (when (and misc (or (not (listp misc)) (= 1 (% (length misc) 2))))
+  (when (and misc (or (not (listp misc)) (cl-oddp (length misc))))
     (error "org-persist: Not a plist: %S" misc))
   (or (org-persist--find-index
        `( :container ,(org-persist--normalize-container container)
index ba8b4d9d3bbaef0bc6751afd37738c8538869a1c..04c70c5b563a17e1977e1d59ae4b6050ac91705c 100644 (file)
@@ -3293,13 +3293,13 @@ styles congruent with the ODF-1.2 specification."
                     (= (1+ r) (car table-dimensions)))
                "LastRow")
               ((and (cdr (assq 'use-banding-rows-styles cell-style-selectors))
-                    (= (% r 2) 1)) "EvenRow")
+                    (cl-oddp r)) "EvenRow")
               ((and (cdr (assq 'use-banding-rows-styles cell-style-selectors))
-                    (= (% r 2) 0)) "OddRow")
+                    (cl-evenp r)) "OddRow")
               ((and (cdr (assq 'use-banding-columns-styles cell-style-selectors))
-                    (= (% c 2) 1)) "EvenColumn")
+                    (cl-oddp c)) "EvenColumn")
               ((and (cdr (assq 'use-banding-columns-styles cell-style-selectors))
-                    (= (% c 2) 0)) "OddColumn")
+                    (cl-evenp c)) "OddColumn")
               (t ""))))
        (concat template-name cell-type)))))
 
index 39ab81b90edd20fb5393c5541f88fe25f9cb5ce6..a9f450968f6d6d6792ffa2ff68f83299baa7c666 100644 (file)
@@ -7287,14 +7287,14 @@ back to standard interface."
                             (lambda (sub-entry)
                               (cl-incf index)
                               (format
-                               (if (zerop (mod index 2)) "    [%s] %-26s"
+                               (if (cl-evenp index) "    [%s] %-26s"
                                  "[%s] %s\n")
                                (funcall fontify-key
                                         (char-to-string (car sub-entry))
                                         top-key)
                                (nth 1 sub-entry)))
                             sub-menu "")
-                           (when (zerop (mod index 2)) "\n"))))))))
+                           (when (cl-evenp index) "\n"))))))))
                entries ""))
             ;; Publishing menu is hard-coded.
             (format "\n[%s] Publish
index ac4088fa8294b327a9ffec0bbdaa2b91aee20c48..496c951d087a485ce5207afec9befd23e199c54d 100644 (file)
@@ -3822,7 +3822,7 @@ modify syntax-type text property if the situation is too hard."
                     (char-after (- (point) 2)))
                 (save-excursion
                   (forward-char -2)
-                  (= 0 (% (skip-chars-backward "\\\\") 2)))
+                  (cl-evenp (skip-chars-backward "\\\\")))
                 (forward-char -1)))
          ;; Now we are after the first part.
          (and is-2arg                  ; Have trailing part
@@ -5161,7 +5161,7 @@ recursive calls in starting lines of here-documents."
                                       (or ; Should work with delim = \
                                        (not (eq (preceding-char) ?\\ ))
                                        ;; XXXX Double \\ is needed with 19.33
-                                       (= (% (skip-chars-backward "\\\\") 2) 0))
+                                       (cl-evenp (skip-chars-backward "\\\\")))
                                       (looking-at
                                        (cond
                                         ((eq (char-after b) ?\] )