From b4bdf44237f990ea972ccf76dfc866a2668315eb Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Mon, 24 Feb 2025 19:27:21 +0100 Subject: [PATCH] Prefer incf to cl-incf in textmodes/*.el * 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 | 4 ++-- lisp/textmodes/reftex-dcr.el | 2 +- lisp/textmodes/reftex-global.el | 6 +++--- lisp/textmodes/reftex-index.el | 16 ++++++++-------- lisp/textmodes/reftex-parse.el | 18 +++++++++--------- lisp/textmodes/reftex-ref.el | 2 +- lisp/textmodes/reftex-sel.el | 4 ++-- lisp/textmodes/reftex.el | 10 +++++----- lisp/textmodes/rst.el | 10 +++++----- lisp/textmodes/tex-mode.el | 2 +- 10 files changed, 37 insertions(+), 37 deletions(-) diff --git a/lisp/textmodes/css-mode.el b/lisp/textmodes/css-mode.el index 85fe59afef8..625f5b77de7 100644 --- a/lisp/textmodes/css-mode.el +++ b/lisp/textmodes/css-mode.el @@ -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) diff --git a/lisp/textmodes/reftex-dcr.el b/lisp/textmodes/reftex-dcr.el index 3b02b550913..77516ca840a 100644 --- a/lisp/textmodes/reftex-dcr.el +++ b/lisp/textmodes/reftex-dcr.el @@ -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) diff --git a/lisp/textmodes/reftex-global.el b/lisp/textmodes/reftex-global.el index 20af2d72837..20abd36192d 100644 --- a/lisp/textmodes/reftex-global.el +++ b/lisp/textmodes/reftex-global.el @@ -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)) diff --git a/lisp/textmodes/reftex-index.el b/lisp/textmodes/reftex-index.el index 38f6f1ba8a2..bd6a5e11147 100644 --- a/lisp/textmodes/reftex-index.el +++ b/lisp/textmodes/reftex-index.el @@ -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)) diff --git a/lisp/textmodes/reftex-parse.el b/lisp/textmodes/reftex-parse.el index d66b0b9064e..0acf91ebe20 100644 --- a/lisp/textmodes/reftex-parse.el +++ b/lisp/textmodes/reftex-parse.el @@ -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))) diff --git a/lisp/textmodes/reftex-ref.el b/lisp/textmodes/reftex-ref.el index 3ac20a0dcfc..d7022cf4a3b 100644 --- a/lisp/textmodes/reftex-ref.el +++ b/lisp/textmodes/reftex-ref.el @@ -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)))))) diff --git a/lisp/textmodes/reftex-sel.el b/lisp/textmodes/reftex-sel.el index 7286c214f7a..1f1c74550a5 100644 --- a/lisp/textmodes/reftex-sel.el +++ b/lisp/textmodes/reftex-sel.el @@ -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)) diff --git a/lisp/textmodes/reftex.el b/lisp/textmodes/reftex.el index cad7e151ad7..91ed55d8337 100644 --- a/lisp/textmodes/reftex.el +++ b/lisp/textmodes/reftex.el @@ -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)) diff --git a/lisp/textmodes/rst.el b/lisp/textmodes/rst.el index ba4ff5cf7b6..1e3151dce03 100644 --- a/lisp/textmodes/rst.el +++ b/lisp/textmodes/rst.el @@ -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. diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el index 78fb2f7d126..f4af1441d1d 100644 --- a/lisp/textmodes/tex-mode.el +++ b/lisp/textmodes/tex-mode.el @@ -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 -- 2.39.5