]> git.eshelyaron.com Git - emacs.git/commitdiff
Prefer incf to cl-incf in textmodes/*.el
authorStefan Kangas <stefankangas@gmail.com>
Mon, 24 Feb 2025 18:27:21 +0000 (19:27 +0100)
committerEshel Yaron <me@eshelyaron.com>
Wed, 26 Feb 2025 09:35:35 +0000 (10:35 +0100)
* lisp/textmodes/css-mode.el (css--rgb-color):
* lisp/textmodes/reftex-dcr.el (reftex-view-regexp-match):
* lisp/textmodes/reftex-global.el (reftex-find-duplicate-labels)
(reftex-renumber-simple-labels, reftex-translate):
* lisp/textmodes/reftex-index.el (reftex-index-select-tag)
(reftex-index-phrases-info, reftex-query-index-phrase):
* lisp/textmodes/reftex-parse.el (reftex-where-am-I)
(reftex-what-macro, reftex-nth-arg, reftex-section-number):
* lisp/textmodes/reftex-ref.el (reftex-uniquify-label):
* lisp/textmodes/reftex-sel.el (reftex-insert-docstruct):
* lisp/textmodes/reftex.el (reftex-next-multifile-index)
(reftex-compile-variables, reftex-parse-args)
(reftex-select-external-document):
* lisp/textmodes/rst.el (rst-display-hdr-hierarchy)
(rst-toc-insert-children, rst-apply-indented-blocks)
(rst-enumerate-region, rst-convert-bullets-to-enumeration):
* lisp/textmodes/tex-mode.el (tex-count-words): Prefer incf to cl-incf.

(cherry picked from commit 0eada9e1d30b9072cdc1bf8388205773cd23986f)

lisp/textmodes/css-mode.el
lisp/textmodes/reftex-dcr.el
lisp/textmodes/reftex-global.el
lisp/textmodes/reftex-index.el
lisp/textmodes/reftex-parse.el
lisp/textmodes/reftex-ref.el
lisp/textmodes/reftex-sel.el
lisp/textmodes/reftex.el
lisp/textmodes/rst.el
lisp/textmodes/tex-mode.el

index 85fe59afef8b29fdc6cee88878e0d5d2d9b9c988..625f5b77de7dfdd46eefb7a93347021b1aac6e63 100644 (file)
@@ -1080,12 +1080,12 @@ the returned hex string."
         (push (min (max 0 (round number)) 255) result)
        (goto-char (match-end 0))
        (css--color-skip-blanks)
-       (cl-incf iter)
+        (incf iter)
        ;; Accept a superset of the CSS syntax since I'm feeling lazy.
        (when (and (= (skip-chars-forward ",/") 0)
                   (= iter 3))
          ;; The alpha is optional.
-         (cl-incf iter))
+          (incf iter))
        (css--color-skip-blanks)))
     (when (looking-at ")")
       (forward-char)
index 3b02b550913d0c3fb085e43590d63a45f91382e3..77516ca840ad2a40a73530eeaf3ec72060196979 100644 (file)
@@ -415,7 +415,7 @@ Calling this function several times find successive citation locations."
     (if match
         (progn
           (put 'reftex-view-regexp-match :props newprop)
-          (put 'reftex-view-regexp-match :cnt (cl-incf cnt))
+          (put 'reftex-view-regexp-match :cnt (incf cnt))
           (reftex-highlight 0 (match-beginning highlight-group)
                             (match-end highlight-group))
           (add-hook 'pre-command-hook #'reftex-highlight-shall-die)
index 20af2d72837a6a02bed3ab0d7b316c874a3ad88e..20abd36192d832166ee05f84df5f436d9d628781 100644 (file)
@@ -169,7 +169,7 @@ No active TAGS table is required."
     (while dlist
       (when (and (car (car dlist))
                  (cdr (car dlist)))
-        (cl-incf cnt)
+        (incf cnt)
         (insert (mapconcat #'identity (car dlist) "\n    ") "\n"))
       (pop dlist))
     (goto-char (point-min))
@@ -238,7 +238,7 @@ one with the `xr' package."
         (if (assoc label translate-alist)
             (error "Duplicate label %s" label))
         (setq new-label (concat (match-string 1 (car entry))
-                                (int-to-string (cl-incf (cdr nr-cell)))))
+                                (int-to-string (incf (cdr nr-cell)))))
         (push (cons label new-label) translate-alist)
         (or (string= label new-label) (setq changed-sequence t))))
 
@@ -350,7 +350,7 @@ one with the `xr' package."
                             (error "Abort")))
                     (reftex-unhighlight 1)))
                  ((and test cell)
-                  (cl-incf n))
+                  (incf n))
                  ((and (not test) cell)
                   ;; Replace
                   (goto-char (match-beginning 1))
index 38f6f1ba8a24877ba1c1acf1e12df7f4d9ee401f..bd6a5e111472a790f2c2cb46430d64a4fc564640 100644 (file)
@@ -210,16 +210,16 @@ will prompt for other arguments."
                 i -1
                 val nil)
           (catch 'exit
-            (while (and (< (cl-incf i) len) (null val))
+            (while (and (< (incf i) len) (null val))
               (unless (assq (aref tag i) tag-alist)
                 (push (list (aref tag i)
                             tag
                             (concat (substring tag 0 i)
-                                    "[" (substring tag i (cl-incf i)) "]"
+                                    "[" (substring tag i (incf i)) "]"
                                     (substring tag i)))
                       tag-alist)
                 (throw 'exit t)))
-            (push (list (+ ?0 (cl-incf cnt)) tag
+            (push (list (+ ?0 (incf cnt)) tag
                         (concat "[" (int-to-string cnt) "]:" tag))
                   tag-alist)))
         (setq tag-alist (nreverse tag-alist))
@@ -1622,11 +1622,11 @@ this function repeatedly."
           (widen)
           (goto-char (point-min))
           (while (re-search-forward re1 nil t)
-            (cl-incf ntimes1))
+            (incf ntimes1))
           (goto-char (point-min))
           (while (re-search-forward re2 nil t)
             (push (cons (count-lines 1 (point)) (match-string 1)) superphrases)
-            (cl-incf ntimes2))))
+            (incf ntimes2))))
       (save-current-buffer
         (while (setq file (pop files))
           (setq buf (reftex-get-file-buffer-force file))
@@ -1639,7 +1639,7 @@ this function repeatedly."
                 (let ((case-fold-search reftex-index-phrases-case-fold-search))
                   (while (re-search-forward re nil t)
                     (or (reftex-in-comment)
-                        (cl-incf nmatches)))))))))
+                        (incf nmatches)))))))))
       (with-output-to-temp-buffer "*Help*"
         (princ (format "       Phrase:  %s\n" phrase))
         (princ (format "    Macro key:  %s\n" char))
@@ -1649,7 +1649,7 @@ this function repeatedly."
          (index-key
           (let ((iks index-keys) (cnt 0) ik)
             (while (setq ik (pop iks))
-              (princ (format "Index entry %d:  %s\n" (cl-incf cnt) ik)))))
+              (princ (format "Index entry %d:  %s\n" (incf cnt) ik)))))
          (repeat
           (princ (format "  Index entry:  %s\n" phrase)))
          (t
@@ -1911,7 +1911,7 @@ both ends."
                    (cond ((member char '(?y ?Y ?\ ))
                           ;; Yes!
                           (replace-match rpl t t)
-                          (cl-incf replace-count)
+                          (incf replace-count)
                           ;; See if we should insert newlines to shorten lines
                           (and reftex-index-phrases-wrap-long-lines
                                (reftex-index-phrases-fixup-line beg end))
index d66b0b9064e467319c71250ccf54b32188bdc913..0acf91ebe20920533f15013ff7b61751a8c3a50b 100644 (file)
@@ -629,7 +629,7 @@ if the information is exact (t) or approximate (nil)."
         found)
     (save-excursion
       (while (not rtn)
-        (cl-incf cnt)
+        (incf cnt)
         (setq found (re-search-backward (reftex-everything-regexp) nil t))
         (setq rtn
               (cond
@@ -693,7 +693,7 @@ if the information is exact (t) or approximate (nil)."
                       (when (and (eq (car (car list)) 'index)
                                  (string= (nth 2 index-info)
                                           (nth 2 (car list))))
-                        (cl-incf n)
+                        (incf n)
                         (setq dist (abs (- (point) (nth 4 (car list)))))
                         (if (or (not last-dist) (< dist last-dist))
                             (setq last-dist dist last (car list))))
@@ -875,8 +875,8 @@ considered an argument of macro \\macro."
                                 (backward-sexp))
                               t)
                           (error nil)))
-              (if (memq (following-char) '(?\( ?\[)) (cl-incf cnt-opt))
-              (cl-incf cnt))
+              (if (memq (following-char) '(?\( ?\[)) (incf cnt-opt))
+              (incf cnt))
             (setq pos (point))
             (when (and (memq (following-char) '(?\[ ?\( ?\{))
                        (re-search-backward "\\\\[*a-zA-Z]+\\=" nil t))
@@ -1017,18 +1017,18 @@ OPT-ARGS is a list of argument numbers which are optional."
         (while (< cnt n)
           (while (and (member cnt opt-args)
                       (eq (following-char) ?\{))
-            (cl-incf cnt))
+            (incf cnt))
           (when (< cnt n)
             (unless (and (condition-case nil
                              (or (forward-list 1) t)
                            (error nil))
                          (reftex-move-to-next-arg)
-                         (cl-incf cnt))
+                         (incf cnt))
               (setq cnt 1000))))
 
         (while (and (memq cnt opt-args)
                     (eq (following-char) ?\{))
-          (cl-incf cnt)))
+          (incf cnt)))
       (if (and (= n cnt)
                (> (skip-chars-forward "{[") 0))
           (reftex-context-substring)
@@ -1114,7 +1114,7 @@ When LEVEL is non-nil, increase section numbers on that level."
           (if (or (not partspecial)
                   (not (= idx 1)))
               (aset reftex-section-numbers idx 0))
-          (cl-incf idx))))
+          (incf idx))))
     (if partspecial
         (setq string (concat "Part " (reftex-roman-number
                                       (aref reftex-section-numbers 0))))
@@ -1124,7 +1124,7 @@ When LEVEL is non-nil, increase section numbers on that level."
         (if (not (and partspecial (not (equal string ""))))
             (setq string (concat string (if (not (string= string "")) "." "")
                                  (int-to-string n))))
-        (cl-incf idx))
+        (incf idx))
       (save-match-data
         (if (string-match "\\`\\([@0]\\.\\)+" string)
             (setq string (replace-match "" nil nil string)))
index 3ac20a0dcfc7a9347187288a96d0101ebf49eba3..d7022cf4a3b178e0f1c4108f756ad7d666469a89 100644 (file)
@@ -374,7 +374,7 @@ also applies `reftex-translate-to-ascii-function' to the string."
            (sep (or separator "")))
       (while (assoc (concat label sep (int-to-string num))
                     (symbol-value reftex-docstruct-symbol))
-        (cl-incf num))
+        (incf num))
       (setcdr cell num)
       (concat label sep (int-to-string num))))))
 
index 7286c214f7ac6083cda50df97776eb26127c3828..1f1c74550a5bfa7122e72f3364ac6c69bde9e08e 100644 (file)
@@ -244,7 +244,7 @@ During a selection process, these are the local bindings.
     ;; Walk the docstruct and insert the appropriate stuff
     (while (setq cell (pop all))
 
-      (cl-incf index)
+      (incf index)
       (setq from (point))
 
       (cond
@@ -314,7 +314,7 @@ During a selection process, these are the local bindings.
                    (or show-commented (null comment)))
 
           ;; Yes we want this one
-          (cl-incf cnt)
+          (incf cnt)
           (setq prev-inserted cell)
 ;         (if (eq offset 'attention) (setq offset cell))
 
index cad7e151ad7a9fe2e4252f74346af4a09e903c0e..91ed55d833749ed81e1771e1b7d61720f4485aea 100644 (file)
@@ -277,7 +277,7 @@ on the menu bar.
 
 (defun reftex-next-multifile-index ()
   ;; Return the next free index for multifile symbols.
-  (cl-incf reftex-multifile-index))
+  (incf reftex-multifile-index))
 
 (defun reftex-tie-multifile-symbols ()
   "Tie the buffer-local symbols to globals connected with the master file.
@@ -937,7 +937,7 @@ This enforces rescanning the buffer on next use."
                          (not (member (aref fmt i) '(?%))))
                (setq word (concat word "\\|" (regexp-quote
                                               (substring fmt 0 (1+ i)))))
-               (cl-incf i))
+               (incf i))
              (cons (concat word "\\)\\=") typekey))
            (nreverse reftex-words-to-typekey-alist)))
 
@@ -990,7 +990,7 @@ This enforces rescanning the buffer on next use."
            (mapconcat
             (lambda(x)
               (format "[%c] %-20.20s%s" (car x) (nth 1 x)
-                      (if (= 0 (mod (cl-incf i) 3)) "\n" "")))
+                      (if (= 0 (mod (incf i) 3)) "\n" "")))
             reftex-key-to-index-macro-alist "")))
 
     ;; Make the full list of section levels
@@ -1084,7 +1084,7 @@ This enforces rescanning the buffer on next use."
               (args (substring macro (match-beginning 0)))
               opt-list nlabel (cnt 0))
           (while (string-match "\\`[[{]\\(\\*\\)?[]}]" args)
-            (cl-incf cnt)
+            (incf cnt)
             (when (eq ?\[ (string-to-char args))
               (push cnt opt-list))
             (when (and (match-end 1)
@@ -1280,7 +1280,7 @@ Valid actions are: readable, restore, read, kill, write."
                   "SELECT EXTERNAL DOCUMENT\n------------------------\n"
                   (mapconcat
                    (lambda (x)
-                     (format fmt (cl-incf n) (or (car x) "")
+                     (format fmt (incf n) (or (car x) "")
                              (abbreviate-file-name (cdr x))))
                    xr-alist ""))
                  nil t))
index ba4ff5cf7b6f64bf5a329f27b0d099140c26efec..1e3151dce038f9882dadcd84928b11685a64ae60 100644 (file)
@@ -2199,7 +2199,7 @@ Hierarchy is displayed in a temporary buffer."
          (rst-update-section hdr)
          (goto-char (point-max))
          (insert "\n")
-         (cl-incf level))))))
+          (incf level))))))
 
 (define-obsolete-function-alias 'rst-display-adornments-hierarchy
   #'rst-display-hdr-hierarchy "29.1")
@@ -2752,7 +2752,7 @@ See `rst-toc-insert-tree' for STYLE, DEPTH and TGT-STN.  See
            (or (rst-toc-insert-stn child buf style depth indent
                                    (concat numbering (format num-fmt count))
                                    keymap tgt-stn) fnd))
-      (cl-incf count))))
+      (incf count))))
 
 ;; FIXME refactoring: Use `rst-Stn-buffer' instead of `buf'.
 (defun rst-toc-insert-stn (stn buf style depth indent numbering keymap tgt-stn)
@@ -3466,7 +3466,7 @@ Otherwise return nil."
             (t ; Non-empty line in indented block.
              (when (or broken in-sub in-super)
                (setq in-first t)
-               (cl-incf count))
+                (incf count))
              (setq in-sub nil)
              (setq in-super nil)))
            (save-excursion
@@ -3494,7 +3494,7 @@ do all lines instead of just paragraphs."
         (in-sub
          (insert indent))
         ((or in-first all)
-         (let ((tag (format "%d. " (cl-incf enum))))
+         (let ((tag (format "%d. " (incf enum))))
            (setq indent (make-string (length tag) ? ))
            (insert tag)))
         (t
@@ -3546,7 +3546,7 @@ Renumber as necessary.  Region is from BEG to END."
           (goto-char marker) nil)
          (looking-at (rst-re 'itmany-beg-1))
          (replace-match (format "%d." count) nil nil nil 1)
-         (cl-incf count))))))
+          (incf count))))))
 
 (defun rst-line-block-region (beg end &optional with-empty)
   "Add line block prefixes for a region.
index 78fb2f7d1261b08c5f2d81f1e2b70069ec14f575..f4af1441d1dd4318556484959c0bfa9e3c07395e 100644 (file)
@@ -1892,7 +1892,7 @@ Mark is left at original location."
        (if (not (eq (char-syntax (preceding-char)) ?/))
            (progn
              ;; Don't count single-char words.
-             (unless (looking-at ".\\>") (cl-incf count))
+              (unless (looking-at ".\\>") (incf count))
              (forward-char 1))
          (let ((cmd
                 (buffer-substring-no-properties