aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Kangas2025-02-25 08:28:30 +0100
committerStefan Kangas2025-02-25 08:28:30 +0100
commitd1d85e0f35d4cb22f2cdfda0672ca33f5bb87b21 (patch)
tree0450a3bbc58be1243ab18c972ac396014cea1792
parent99d116a8f41c29193cb41d0cde24a7051237ecf4 (diff)
downloademacs-d1d85e0f35d4cb22f2cdfda0672ca33f5bb87b21.tar.gz
emacs-d1d85e0f35d4cb22f2cdfda0672ca33f5bb87b21.zip
Prefer incf to cl-incf in progmodes/*.el
* lisp/progmodes/bug-reference.el (bug-reference--overlay-bounds): * lisp/progmodes/c-ts-common.el (c-ts-common-statement-offset): * lisp/progmodes/compile.el (compilation--note-type): * lisp/progmodes/ebrowse.el (ebrowse-files-table) (ebrowse-fill-member-table, ebrowse-find-pattern) (ebrowse-draw-member-short-fn, ebrowse-gather-statistics): * lisp/progmodes/elixir-ts-mode.el (elixir-ts--electric-pair-string-delimiter): * lisp/progmodes/gdb-mi.el (gdb-thread-list-handler-custom): * lisp/progmodes/grep.el (grep-filter): * lisp/progmodes/hideif.el (hif-backward-comment, hif-__COUNTER__) (hif-token-concatenation, hif-find-define): * lisp/progmodes/js.el (js--pstate-is-toplevel-defun) (js-beginning-of-defun, js-end-of-defun, js--pitems-to-imenu) (js--imenu-to-flat, js-ts--syntax-propertize): * lisp/progmodes/tcl.el (tcl--syntax-of-quote): * lisp/progmodes/typescript-ts-mode.el (tsx-ts--syntax-propertize-captures): Prefer incf to cl-incf.
-rw-r--r--lisp/progmodes/bug-reference.el2
-rw-r--r--lisp/progmodes/c-ts-common.el6
-rw-r--r--lisp/progmodes/compile.el6
-rw-r--r--lisp/progmodes/ebrowse.el18
-rw-r--r--lisp/progmodes/elixir-ts-mode.el2
-rw-r--r--lisp/progmodes/gdb-mi.el6
-rw-r--r--lisp/progmodes/grep.el2
-rw-r--r--lisp/progmodes/hideif.el12
-rw-r--r--lisp/progmodes/js.el12
-rw-r--r--lisp/progmodes/tcl.el4
-rw-r--r--lisp/progmodes/typescript-ts-mode.el2
11 files changed, 36 insertions, 36 deletions
diff --git a/lisp/progmodes/bug-reference.el b/lisp/progmodes/bug-reference.el
index a4147bca05e..5c03c949049 100644
--- a/lisp/progmodes/bug-reference.el
+++ b/lisp/progmodes/bug-reference.el
@@ -138,7 +138,7 @@ to the highlighted and clickable region."
138 (or (< (match-beginning i) m-b1) 138 (or (< (match-beginning i) m-b1)
139 (> (match-end i) m-e1))) 139 (> (match-end i) m-e1)))
140 (throw 'within-bounds nil)) 140 (throw 'within-bounds nil))
141 (cl-incf i)) 141 (incf i))
142 t))) 142 t)))
143 ;; All groups 2..10 are within bounds. 143 ;; All groups 2..10 are within bounds.
144 (cons m-b1 m-e1) 144 (cons m-b1 m-e1)
diff --git a/lisp/progmodes/c-ts-common.el b/lisp/progmodes/c-ts-common.el
index 6e36b64f02a..66e7fad015d 100644
--- a/lisp/progmodes/c-ts-common.el
+++ b/lisp/progmodes/c-ts-common.el
@@ -503,7 +503,7 @@ characters on the current line."
503 (let ((parent (treesit-node-parent node))) 503 (let ((parent (treesit-node-parent node)))
504 ;; Increment level for every bracket (with exception). 504 ;; Increment level for every bracket (with exception).
505 (when (c-ts-common--node-is node 'block) 505 (when (c-ts-common--node-is node 'block)
506 (cl-incf level) 506 (incf level)
507 (save-excursion 507 (save-excursion
508 (goto-char (treesit-node-start node)) 508 (goto-char (treesit-node-start node))
509 ;; Add an extra level if the opening bracket is on its own 509 ;; Add an extra level if the opening bracket is on its own
@@ -515,12 +515,12 @@ characters on the current line."
515 ;; Add a level. 515 ;; Add a level.
516 ((looking-back (rx bol (* whitespace)) 516 ((looking-back (rx bol (* whitespace))
517 (line-beginning-position)) 517 (line-beginning-position))
518 (cl-incf level))))) 518 (incf level)))))
519 ;; Fix bracketless statements. 519 ;; Fix bracketless statements.
520 (when (and (c-ts-common--node-is parent 520 (when (and (c-ts-common--node-is parent
521 'if 'do 'while 'for) 521 'if 'do 'while 'for)
522 (not (c-ts-common--node-is node 'block))) 522 (not (c-ts-common--node-is node 'block)))
523 (cl-incf level)) 523 (incf level))
524 ;; Flatten "else if" statements. 524 ;; Flatten "else if" statements.
525 (when (and (c-ts-common--node-is node 'else) 525 (when (and (c-ts-common--node-is node 'else)
526 (c-ts-common--node-is node 'if) 526 (c-ts-common--node-is node 'if)
diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el
index 3d6ffd1fbe4..a1264d8d7b0 100644
--- a/lisp/progmodes/compile.el
+++ b/lisp/progmodes/compile.el
@@ -1641,9 +1641,9 @@ RULE is the name (symbol) of the rule used or nil if anonymous.
1641 "Note that a new message with severity TYPE was seen. 1641 "Note that a new message with severity TYPE was seen.
1642This updates the appropriate variable used by the mode-line." 1642This updates the appropriate variable used by the mode-line."
1643 (cl-case type 1643 (cl-case type
1644 (0 (cl-incf compilation-num-infos-found)) 1644 (0 (incf compilation-num-infos-found))
1645 (1 (cl-incf compilation-num-warnings-found)) 1645 (1 (incf compilation-num-warnings-found))
1646 (2 (cl-incf compilation-num-errors-found)))) 1646 (2 (incf compilation-num-errors-found))))
1647 1647
1648(defun compilation-parse-errors (start end &rest rules) 1648(defun compilation-parse-errors (start end &rest rules)
1649 "Parse errors between START and END. 1649 "Parse errors between START and END.
diff --git a/lisp/progmodes/ebrowse.el b/lisp/progmodes/ebrowse.el
index 70e1a1e5904..72e80811fb5 100644
--- a/lisp/progmodes/ebrowse.el
+++ b/lisp/progmodes/ebrowse.el
@@ -593,7 +593,7 @@ MARKED-ONLY non-nil means include marked classes only."
593 (ebrowse-for-all-trees (tree ebrowse--tree-table) 593 (ebrowse-for-all-trees (tree ebrowse--tree-table)
594 (when (or (not marked-only) (ebrowse-ts-mark tree)) 594 (when (or (not marked-only) (ebrowse-ts-mark tree))
595 (let ((class (ebrowse-ts-class tree))) 595 (let ((class (ebrowse-ts-class tree)))
596 (when (zerop (% (cl-incf i) 20)) 596 (when (zerop (% (incf i) 20))
597 (ebrowse-show-progress "Preparing file list" (zerop i))) 597 (ebrowse-show-progress "Preparing file list" (zerop i)))
598 ;; Add files mentioned in class description 598 ;; Add files mentioned in class description
599 (let ((source-file (ebrowse-cs-source-file class)) 599 (let ((source-file (ebrowse-cs-source-file class))
@@ -864,7 +864,7 @@ type `ebrowse-hs' is set to the resulting table."
864 (garbage-collect) 864 (garbage-collect)
865 ;; For all classes... 865 ;; For all classes...
866 (ebrowse-for-all-trees (c ebrowse--tree-table) 866 (ebrowse-for-all-trees (c ebrowse--tree-table)
867 (when (zerop (% (cl-incf i) 10)) 867 (when (zerop (% (incf i) 10))
868 (ebrowse-show-progress "Preparing member lookup" (zerop i))) 868 (ebrowse-show-progress "Preparing member lookup" (zerop i)))
869 (dolist (f ebrowse-member-list-accessors) 869 (dolist (f ebrowse-member-list-accessors)
870 (dolist (m (funcall f c)) 870 (dolist (m (funcall f c))
@@ -1649,7 +1649,7 @@ INFO is a list (TREE-HEADER TREE-OR-MEMBER MEMBER-LIST)."
1649 when (re-search-forward pattern (+ start offset) t) 1649 when (re-search-forward pattern (+ start offset) t)
1650 return t 1650 return t
1651 never (bobp) 1651 never (bobp)
1652 do (cl-incf offset offset))) 1652 do (incf offset offset)))
1653 (cond (found 1653 (cond (found
1654 (beginning-of-line) 1654 (beginning-of-line)
1655 (run-hooks 'ebrowse-view/find-hook)) 1655 (run-hooks 'ebrowse-view/find-hook))
@@ -2689,7 +2689,7 @@ TREE is the class tree in which the members are found."
2689 mouse-face highlight 2689 mouse-face highlight
2690 ebrowse-tree ,tree 2690 ebrowse-tree ,tree
2691 help-echo "mouse-2: view definition; mouse-3: menu")) 2691 help-echo "mouse-2: view definition; mouse-3: menu"))
2692 (cl-incf i) 2692 (incf i)
2693 (when (>= i ebrowse--n-columns) 2693 (when (>= i ebrowse--n-columns)
2694 (setf i 0) 2694 (setf i 0)
2695 (insert "\n"))))) 2695 (insert "\n")))))
@@ -4032,11 +4032,11 @@ NUMBER-OF-STATIC-VARIABLES:"
4032 (let ((classes 0) (member-functions 0) (member-variables 0) 4032 (let ((classes 0) (member-functions 0) (member-variables 0)
4033 (static-functions 0) (static-variables 0)) 4033 (static-functions 0) (static-variables 0))
4034 (ebrowse-for-all-trees (tree ebrowse--tree-table) 4034 (ebrowse-for-all-trees (tree ebrowse--tree-table)
4035 (cl-incf classes) 4035 (incf classes)
4036 (cl-incf member-functions (length (ebrowse-ts-member-functions tree))) 4036 (incf member-functions (length (ebrowse-ts-member-functions tree)))
4037 (cl-incf member-variables (length (ebrowse-ts-member-variables tree))) 4037 (incf member-variables (length (ebrowse-ts-member-variables tree)))
4038 (cl-incf static-functions (length (ebrowse-ts-static-functions tree))) 4038 (incf static-functions (length (ebrowse-ts-static-functions tree)))
4039 (cl-incf static-variables (length (ebrowse-ts-static-variables tree)))) 4039 (incf static-variables (length (ebrowse-ts-static-variables tree))))
4040 (list classes member-functions member-variables 4040 (list classes member-functions member-variables
4041 static-functions static-variables))) 4041 static-functions static-variables)))
4042 4042
diff --git a/lisp/progmodes/elixir-ts-mode.el b/lisp/progmodes/elixir-ts-mode.el
index a0d503632d9..d50692d87c0 100644
--- a/lisp/progmodes/elixir-ts-mode.el
+++ b/lisp/progmodes/elixir-ts-mode.el
@@ -658,7 +658,7 @@ Return nil if NODE is not a defun node or doesn't have a name."
658 (eq last-command-event ?\") 658 (eq last-command-event ?\")
659 (let ((count 0)) 659 (let ((count 0))
660 (while (eq (char-before (- (point) count)) last-command-event) 660 (while (eq (char-before (- (point) count)) last-command-event)
661 (cl-incf count)) 661 (incf count))
662 (= count 3)) 662 (= count 3))
663 (eq (char-after) last-command-event)) 663 (eq (char-after) last-command-event))
664 (save-excursion 664 (save-excursion
diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el
index 040d4b7e9af..74dff3217ff 100644
--- a/lisp/progmodes/gdb-mi.el
+++ b/lisp/progmodes/gdb-mi.el
@@ -3545,9 +3545,9 @@ corresponding to the mode line clicked."
3545 (add-to-list 'gdb-threads-list 3545 (add-to-list 'gdb-threads-list
3546 (cons (gdb-mi--field thread 'id) 3546 (cons (gdb-mi--field thread 'id)
3547 thread)) 3547 thread))
3548 (cl-incf (if running 3548 (incf (if running
3549 gdb-running-threads-count 3549 gdb-running-threads-count
3550 gdb-stopped-threads-count)) 3550 gdb-stopped-threads-count))
3551 3551
3552 (gdb-table-add-row 3552 (gdb-table-add-row
3553 table 3553 table
diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el
index d04e9945b0d..951663e049a 100644
--- a/lisp/progmodes/grep.el
+++ b/lisp/progmodes/grep.el
@@ -648,7 +648,7 @@ This function is called from `compilation-filter-hook'."
648 (replace-match (propertize (match-string 1) 648 (replace-match (propertize (match-string 1)
649 'face nil 'font-lock-face grep-match-face) 649 'face nil 'font-lock-face grep-match-face)
650 t t) 650 t t)
651 (cl-incf grep-num-matches-found)) 651 (incf grep-num-matches-found))
652 ;; Delete all remaining escape sequences 652 ;; Delete all remaining escape sequences
653 (goto-char beg) 653 (goto-char beg)
654 (while (re-search-forward "\033\\[[0-9;]*[mK]" end 1) 654 (while (re-search-forward "\033\\[[0-9;]*[mK]" end 1)
diff --git a/lisp/progmodes/hideif.el b/lisp/progmodes/hideif.el
index 0d5797bb303..0ddaf513a02 100644
--- a/lisp/progmodes/hideif.el
+++ b/lisp/progmodes/hideif.el
@@ -888,7 +888,7 @@ Assuming we've just performed a `hif-token-regexp' lookup."
888 ;; merge whites immediately ahead 888 ;; merge whites immediately ahead
889 (setq ce (if (and we (= (1- p) we)) ws p)) 889 (setq ce (if (and we (= (1- p) we)) ws p))
890 ;; scan for end of line 890 ;; scan for end of line
891 (while (and (< (cl-incf p) end) 891 (while (and (< (incf p) end)
892 (not (char-equal ?\n (char-after p))) 892 (not (char-equal ?\n (char-after p)))
893 (not (char-equal ?\r (char-after p))))) 893 (not (char-equal ?\r (char-after p)))))
894 ;; Merge with previous comment if immediately followed 894 ;; Merge with previous comment if immediately followed
@@ -913,7 +913,7 @@ Assuming we've just performed a `hif-token-regexp' lookup."
913 (while (< (1+ p) end) 913 (while (< (1+ p) end)
914 (if (not (and (char-equal ?* (char-after p)) 914 (if (not (and (char-equal ?* (char-after p))
915 (char-equal ?/ (char-after (1+ p))))) 915 (char-equal ?/ (char-after (1+ p)))))
916 (cl-incf p) 916 (incf p)
917 ;; found `*/', mark end pos 917 ;; found `*/', mark end pos
918 (push (cons cmt (1+ (setq p (1+ p)))) cmtlist) 918 (push (cons cmt (1+ (setq p (1+ p)))) cmtlist)
919 (throw 'break nil))) 919 (throw 'break nil)))
@@ -927,7 +927,7 @@ Assuming we've just performed a `hif-token-regexp' lookup."
927 we p)) 927 we p))
928 (setq ws nil 928 (setq ws nil
929 we nil))) 929 we nil)))
930 (cl-incf p)) 930 (incf p))
931 ;; Goto beginning of the last comment, if we're within 931 ;; Goto beginning of the last comment, if we're within
932 (setq cmt (car cmtlist)) ;; last cmt 932 (setq cmt (car cmtlist)) ;; last cmt
933 (setq cmt (if (and cmt 933 (setq cmt (if (and cmt
@@ -1531,7 +1531,7 @@ and `+='...)."
1531 1531
1532(defvar hif-__COUNTER__ 0) 1532(defvar hif-__COUNTER__ 0)
1533(defun hif-__COUNTER__ () 1533(defun hif-__COUNTER__ ()
1534 (prog1 hif-__COUNTER__ (cl-incf hif-__COUNTER__))) 1534 (prog1 hif-__COUNTER__ (incf hif-__COUNTER__)))
1535 1535
1536(defun hif-__cplusplus () 1536(defun hif-__cplusplus ()
1537 (and (string-match 1537 (and (string-match
@@ -1604,7 +1604,7 @@ and `+='...)."
1604 (push tk items) ; first item, in reverse order 1604 (push tk items) ; first item, in reverse order
1605 (setq tk 'hif-token-concat)) 1605 (setq tk 'hif-token-concat))
1606 (while (eq tk 'hif-token-concat) 1606 (while (eq tk 'hif-token-concat)
1607 (cl-incf count) 1607 (incf count)
1608 ;; 2+ item 1608 ;; 2+ item
1609 (setq l (cdr l) 1609 (setq l (cdr l)
1610 tk (car l)) 1610 tk (car l))
@@ -2477,7 +2477,7 @@ first arg will be `hif-etc'."
2477 (tokens 2477 (tokens
2478 (and name 2478 (and name
2479 (prog1 t 2479 (prog1 t
2480 (cl-incf hif-verbose-define-count) 2480 (incf hif-verbose-define-count)
2481 ;; only show 1/50 to not slow down to much 2481 ;; only show 1/50 to not slow down to much
2482 (if (and hide-ifdef-verbose 2482 (if (and hide-ifdef-verbose
2483 (= (% hif-verbose-define-count 50) 1)) 2483 (= (% hif-verbose-define-count 50) 1))
diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el
index bb91eea93f2..1142786ffaa 100644
--- a/lisp/progmodes/js.el
+++ b/lisp/progmodes/js.el
@@ -982,7 +982,7 @@ top-most pitem. Otherwise, return nil."
982 with func-depth = 0 982 with func-depth = 0
983 with func-pitem 983 with func-pitem
984 if (eq 'function (js--pitem-type pitem)) 984 if (eq 'function (js--pitem-type pitem))
985 do (cl-incf func-depth) 985 do (incf func-depth)
986 and do (setq func-pitem pitem) 986 and do (setq func-pitem pitem)
987 finally return (if (eq func-depth 1) func-pitem))) 987 finally return (if (eq func-depth 1) func-pitem)))
988 988
@@ -1017,7 +1017,7 @@ Return the pitem of the function we went to the beginning of."
1017 (setq arg (or arg 1)) 1017 (setq arg (or arg 1))
1018 (let ((found)) 1018 (let ((found))
1019 (while (and (not (eobp)) (< arg 0)) 1019 (while (and (not (eobp)) (< arg 0))
1020 (cl-incf arg) 1020 (incf arg)
1021 (when (and (not js-flat-functions) 1021 (when (and (not js-flat-functions)
1022 (or (eq (js-syntactic-context) 'function) 1022 (or (eq (js-syntactic-context) 'function)
1023 (js--function-prologue-beginning))) 1023 (js--function-prologue-beginning)))
@@ -1360,7 +1360,7 @@ LIMIT defaults to point."
1360 "Value of `end-of-defun-function' for `js-mode'." 1360 "Value of `end-of-defun-function' for `js-mode'."
1361 (setq arg (or arg 1)) 1361 (setq arg (or arg 1))
1362 (while (and (not (bobp)) (< arg 0)) 1362 (while (and (not (bobp)) (< arg 0))
1363 (cl-incf arg) 1363 (incf arg)
1364 (js-beginning-of-defun) 1364 (js-beginning-of-defun)
1365 (js-beginning-of-defun) 1365 (js-beginning-of-defun)
1366 (unless (bobp) 1366 (unless (bobp)
@@ -3180,7 +3180,7 @@ the broken-down class name of the item to insert."
3180 (setq pitem-name (js--pitem-strname pitem)) 3180 (setq pitem-name (js--pitem-strname pitem))
3181 (when (eq pitem-name t) 3181 (when (eq pitem-name t)
3182 (setq pitem-name (format "[unknown %s]" 3182 (setq pitem-name (format "[unknown %s]"
3183 (cl-incf (car unknown-ctr))))) 3183 (incf (car unknown-ctr)))))
3184 3184
3185 (cond 3185 (cond
3186 ((memq pitem-type '(function macro)) 3186 ((memq pitem-type '(function macro))
@@ -3255,7 +3255,7 @@ the broken-down class name of the item to insert."
3255 (ctr 0)) 3255 (ctr 0))
3256 3256
3257 (while (gethash name2 symbols) 3257 (while (gethash name2 symbols)
3258 (setq name2 (format "%s<%d>" name (cl-incf ctr)))) 3258 (setq name2 (format "%s<%d>" name (incf ctr))))
3259 3259
3260 (puthash name2 (cdr item) symbols)))) 3260 (puthash name2 (cdr item) symbols))))
3261 3261
@@ -4037,7 +4037,7 @@ See `treesit-thing-settings' for more information.")
4037 (syntax (pcase-exhaustive name 4037 (syntax (pcase-exhaustive name
4038 ('regexp 4038 ('regexp
4039 (decf ns) 4039 (decf ns)
4040 (cl-incf ne) 4040 (incf ne)
4041 (string-to-syntax "\"/")) 4041 (string-to-syntax "\"/"))
4042 ('jsx 4042 ('jsx
4043 (string-to-syntax "|"))))) 4043 (string-to-syntax "|")))))
diff --git a/lisp/progmodes/tcl.el b/lisp/progmodes/tcl.el
index c4b40f4a170..e1efade517d 100644
--- a/lisp/progmodes/tcl.el
+++ b/lisp/progmodes/tcl.el
@@ -432,9 +432,9 @@ This variable is generally set from `tcl-proc-regexp',
432 (pcase (char-after (match-beginning 0)) 432 (pcase (char-after (match-beginning 0))
433 (?\\ (forward-char 1)) 433 (?\\ (forward-char 1))
434 (?\" (setq type 'matched)) 434 (?\" (setq type 'matched))
435 (?\{ (cl-incf depth)) 435 (?\{ (incf depth))
436 (?\} (if (zerop depth) (setq type 'unmatched) 436 (?\} (if (zerop depth) (setq type 'unmatched)
437 (cl-incf depth))))) 437 (incf depth)))))
438 (when (> (line-beginning-position) pos) 438 (when (> (line-beginning-position) pos)
439 ;; The quote is not on the same line as the deciding 439 ;; The quote is not on the same line as the deciding
440 ;; factor, so make sure we revisit this choice later. 440 ;; factor, so make sure we revisit this choice later.
diff --git a/lisp/progmodes/typescript-ts-mode.el b/lisp/progmodes/typescript-ts-mode.el
index 34d9e8636d1..759578d7b9d 100644
--- a/lisp/progmodes/typescript-ts-mode.el
+++ b/lisp/progmodes/typescript-ts-mode.el
@@ -680,7 +680,7 @@ at least 3 (which is the default value)."
680 ('regexp 680 ('regexp
681 (let ((syntax (string-to-syntax "\"/"))) 681 (let ((syntax (string-to-syntax "\"/")))
682 (decf ns) 682 (decf ns)
683 (cl-incf ne) 683 (incf ne)
684 (put-text-property ns (1+ ns) 'syntax-table syntax) 684 (put-text-property ns (1+ ns) 'syntax-table syntax)
685 (put-text-property (1- ne) ne 'syntax-table syntax))) 685 (put-text-property (1- ne) ne 'syntax-table syntax)))
686 ;; We put punctuation syntax on all the balanced pair 686 ;; We put punctuation syntax on all the balanced pair