all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [PATCH] Use cl-incf/cl-decf in files that require cl-lib
@ 2016-11-10  6:13 Tino Calancha
  0 siblings, 0 replies; only message in thread
From: Tino Calancha @ 2016-11-10  6:13 UTC (permalink / raw)
  To: Emacs developers; +Cc: Tino Calancha


Hi

we have several files in emacs tree source that require cl-lib,
and increase/decrease variables like:

I)

(setq i (1+ i)
or
(setq foo-bar-baz-long-var (1- foo-bar-baz-long-var))

Since they already require cl-lib, they could be replaced by
the more readable:
II)

(cl-incf i)
or
(cl-decf foo-bar-baz-long-var)

Following patch replace things like in I) with their analog in II) for
those files that require cl-lib at the beginning of the file.

Is there motivation to add these changes?

Thank you
Tino

;;;; ****************************** PATCH STARTS ******************************
From c34925628eb516cd40d3bb721fba6da0aa940587 Mon Sep 17 00:00:00 2001
From: Tino Calancha <tino.calancha@gmail.com>
Date: Thu, 10 Nov 2016 13:38:30 +0900
Subject: [PATCH 1/2] Use cl-incf and cl-decf on all cl-lib files

* lisp/emacs-lisp/cl-extra.el (cl-equalp, cl--mapcar-many, cl-signum)
(cl-random, cl-subseq): Use cl-incf and cl-decf.
* lisp/emacs-lisp/cl-generic.el (cl-generic-define-method): Idem.
* lisp/emacs-lisp/cl-indent.el (common-lisp-indent-function-1): Idem.
* lisp/emacs-lisp/cl-macs.el (cl--simple-expr-p, cl-gensym)
(cl-gentemp, cl--do-arglist, cl--parse-loop-clause, cl-multiple-value-bind)
(cl-multiple-value-setq, cl-defstruct): Idem.
* lisp/emacs-lisp/cl-seq.el (cl-fill, cl-replace, cl-remove, cl-delete)
(cl--delete-duplicates, cl-nsubstitute, cl--position, cl-count): Idem.
---
  lisp/emacs-lisp/cl-extra.el   | 12 ++++++------
  lisp/emacs-lisp/cl-generic.el |  2 +-
  lisp/emacs-lisp/cl-indent.el  |  4 ++--
  lisp/emacs-lisp/cl-macs.el    | 18 +++++++++---------
  lisp/emacs-lisp/cl-seq.el     | 40 ++++++++++++++++++++--------------------
  5 files changed, 38 insertions(+), 38 deletions(-)

diff --git a/lisp/emacs-lisp/cl-extra.el b/lisp/emacs-lisp/cl-extra.el
index 0033a94..c15b6c5 100644
--- a/lisp/emacs-lisp/cl-extra.el
+++ b/lisp/emacs-lisp/cl-extra.el
@@ -80,7 +80,7 @@ cl-equalp
  	((vectorp x)
  	 (and (vectorp y) (= (length x) (length y))
  	      (let ((i (length x)))
-		(while (and (>= (setq i (1- i)) 0)
+		(while (and (>= (cl-decf i) 0)
  			    (cl-equalp (aref x i) (aref y i))))
  		(< i 0))))
  	(t (equal x y))))
@@ -107,14 +107,14 @@ cl--mapcar-many
  		      (aref (car cl-p1) cl-i)))
  	    (setq cl-p1 (cdr cl-p1) cl-p2 (cdr cl-p2)))
  	  (push (apply cl-func cl-args) cl-res)
-	  (setq cl-i (1+ cl-i)))
+	  (cl-incf cl-i))
  	(nreverse cl-res))
      (let ((cl-res nil)
  	  (cl-x (car cl-seqs))
  	  (cl-y (nth 1 cl-seqs)))
        (let ((cl-n (min (length cl-x) (length cl-y)))
  	    (cl-i -1))
-	(while (< (setq cl-i (1+ cl-i)) cl-n)
+	(while (< (cl-incf cl-i) cl-n)
  	  (push (funcall cl-func
                           (if (consp cl-x) (pop cl-x) (aref cl-x cl-i))
                           (if (consp cl-y) (pop cl-y) (aref cl-y cl-i)))
@@ -402,7 +402,7 @@ cl-signum
      (cl-flet ((skip-whitespace ()
  		(while (and (< start end)
  			    (= 32 (char-syntax (aref string start))))
-		  (setq start (1+ start)))))
+		  (cl-incf start))))
        (skip-whitespace)
        (let ((sign (cl-case (and (< start end) (aref string start))
  		    (?+ (cl-incf start) +1)
@@ -436,7 +436,7 @@ cl-random
  	  (aset vec 0 j)
  	  (while (> (setq i (% (+ i 21) 55)) 0)
  	    (aset vec i (setq j (prog1 k (setq k (- j k))))))
-	  (while (< (setq i (1+ i)) 200) (cl-random 2 state))))
+	  (while (< (cl-incf i) 200) (cl-random 2 state))))
      (let* ((i (aset state 1 (% (1+ (aref state 1)) 55)))
  	   (j (aset state 2 (% (1+ (aref state 2)) 55)))
  	   (n (logand 8388607 (aset vec i (- (aref vec i) (aref vec j))))))
@@ -541,7 +541,7 @@ cl-subseq
               (setq seq (cdr seq)))
             (if end
                 (let ((res nil))
-                 (while (and (>= (setq end (1- end)) start) seq)
+                 (while (and (>= (cl-decf end) start) seq)
                     (push (pop seq) res))
                   (or (= (1+ end) start) (error "%s" errtext))
                   (nreverse res))
diff --git a/lisp/emacs-lisp/cl-generic.el b/lisp/emacs-lisp/cl-generic.el
index 61186e1..51fefe6 100644
--- a/lisp/emacs-lisp/cl-generic.el
+++ b/lisp/emacs-lisp/cl-generic.el
@@ -488,7 +488,7 @@ cl-generic-define-method
                          (lambda (x y)
                            (> (cl--generic-generalizer-priority x)
                               (cl--generic-generalizer-priority y)))))))
-        (setq i (1+ i))))
+        (cl-incf i)))
      ;; We used to (setcar me method), but that can cause false positives in
      ;; the hash-consing table of the method-builder (bug#20644).
      ;; See also the related FIXME in cl--generic-build-combined-method.
diff --git a/lisp/emacs-lisp/cl-indent.el b/lisp/emacs-lisp/cl-indent.el
index 4f1100c..7e0ab03 100644
--- a/lisp/emacs-lisp/cl-indent.el
+++ b/lisp/emacs-lisp/cl-indent.el
@@ -373,7 +373,7 @@ common-lisp-indent-function-1
                                     nil
                                   (parse-partial-sexp (point)
                                                       indent-point 1 t)
-                                 (setq n (1+ n))
+                                 (cl-incf n)
                                   t))
                             (error nil))))
                (setq path (cons n path)))
@@ -469,7 +469,7 @@ common-lisp-indent-function-1
            (unless calculated
  	    (condition-case ()
  		(progn (backward-up-list 1)
-		       (setq depth (1+ depth)))
+		       (cl-incf depth))
  	      (error (setq depth lisp-indent-maximum-backtracking))))))
        (or calculated tentative-calculated))))

diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el
index 2ebb824..2eea8fb 100644
--- a/lisp/emacs-lisp/cl-macs.el
+++ b/lisp/emacs-lisp/cl-macs.el
@@ -94,7 +94,7 @@ cl--simple-expr-p
  	   (or (memq (car x) cl--simple-funcs)
  	       (get (car x) 'side-effect-free))
  	   (progn
-	     (setq size (1- size))
+	     (cl-decf size)
  	     (while (and (setq x (cdr x))
  			 (setq size (cl--simple-expr-p (car x) size))))
  	     (and (null x) (>= size 0) size)))
@@ -169,7 +169,7 @@ cl-gensym
    (let ((pfix (if (stringp prefix) prefix "G"))
  	(num (if (integerp prefix) prefix
  	       (prog1 cl--gensym-counter
-		 (setq cl--gensym-counter (1+ cl--gensym-counter))))))
+		 (cl-incf cl--gensym-counter)))))
      (make-symbol (format "%s%d" pfix num))))

  ;;;###autoload
@@ -179,7 +179,7 @@ cl-gentemp
    (let ((pfix (if (stringp prefix) prefix "G"))
  	name)
      (while (intern-soft (setq name (format "%s%d" pfix cl--gensym-counter)))
-      (setq cl--gensym-counter (1+ cl--gensym-counter)))
+      (cl-incf cl--gensym-counter))
      (intern name)))


@@ -582,7 +582,7 @@ cl--do-arglist
  	      (and def cl--bind-enquote (setq def `',def))
  	      (cl--do-arglist (car arg)
  			     (if def `(if ,restarg ,poparg ,def) poparg))
-	      (setq num (1+ num))))))
+	      (cl-incf num)))))
        (if (eq (car args) '&rest)
  	  (let ((arg (cl--pop2 args)))
  	    (if (consp arg) (cl--do-arglist arg restarg)))
@@ -1294,7 +1294,7 @@ cl--parse-loop-clause
  		      (temp-idx (make-symbol "--cl-idx--")))
  		  (push (list temp-vec (pop cl--loop-args)) loop-for-bindings)
  		  (push (list temp-idx -1) loop-for-bindings)
-		  (push `(< (setq ,temp-idx (1+ ,temp-idx))
+		  (push `(< (cl-incf ,temp-idx)
                              (length ,temp-vec))
                          cl--loop-body)
  		  (if (eq word 'across-ref)
@@ -1482,7 +1482,7 @@ cl--parse-loop-clause
       ((eq word 'repeat)
        (let ((temp (make-symbol "--cl-var--")))
  	(push (list (list temp (pop cl--loop-args))) cl--loop-bindings)
-	(push `(>= (setq ,temp (1- ,temp)) 0) cl--loop-body)))
+	(push `(>= (cl-decf ,temp) 0) cl--loop-body)))

       ((memq word '(collect collecting))
        (let ((what (pop cl--loop-args))
@@ -2175,7 +2175,7 @@ cl-multiple-value-bind
    (let ((temp (make-symbol "--cl-var--")) (n -1))
      `(let* ((,temp ,form)
              ,@(mapcar (lambda (v)
-                        (list v `(nth ,(setq n (1+ n)) ,temp)))
+                        (list v `(nth ,(cl-incf n) ,temp)))
                        vars))
         ,@body)))

@@ -2197,7 +2197,7 @@ cl-multiple-value-setq
                (prog1 (setq ,(pop vars) (car ,temp))
                  (setq ,@(apply #'nconc
                                 (mapcar (lambda (v)
-                                         (list v `(nth ,(setq n (1+ n))
+                                         (list v `(nth ,(cl-incf n)
                                                         ,temp)))
                                         vars)))))))))

@@ -2764,7 +2764,7 @@ cl-defstruct
  		  (nconc print-func
  			 (list `(princ ,(format " %s" slot) cl-s)
  			       `(prin1 (,accessor cl-x) cl-s)))))))
-	(setq pos (1+ pos))))
+	(cl-incf pos)))
      (setq slots (nreverse slots)
  	  defaults (nreverse defaults))
      (when pred-form
diff --git a/lisp/emacs-lisp/cl-seq.el b/lisp/emacs-lisp/cl-seq.el
index 3f8b1ee..f27fc05 100644
--- a/lisp/emacs-lisp/cl-seq.el
+++ b/lisp/emacs-lisp/cl-seq.el
@@ -160,7 +160,7 @@ cl-fill
  	  (fillarray cl-seq cl-item)
  	(while (< cl-start cl-end)
  	  (aset cl-seq cl-start cl-item)
-	  (setq cl-start (1+ cl-start)))))
+	  (cl-incf cl-start))))
      cl-seq))

  ;;;###autoload
@@ -175,7 +175,7 @@ cl-replace
  	    (let* ((cl-len (length cl-seq1))
  		   (cl-n (min (- (or cl-end1 cl-len) cl-start1)
  			      (- (or cl-end2 cl-len) cl-start2))))
-	      (while (>= (setq cl-n (1- cl-n)) 0)
+	      (while (>= (cl-decf cl-n) 0)
  		(setf (elt cl-seq1 (+ cl-start1 cl-n))
  			    (elt cl-seq2 (+ cl-start2 cl-n))))))
        (if (listp cl-seq1)
@@ -239,10 +239,10 @@ cl-remove
  	    (while (and cl-seq (> cl-end 0)
  			(cl--check-test cl-item (car cl-seq))
  			(setq cl-end (1- cl-end) cl-seq (cdr cl-seq))
-			(> (setq cl-count (1- cl-count)) 0))))
+			(> (cl-decf cl-count) 0))))
  	(if (and (> cl-count 0) (> cl-end 0))
  	    (let ((cl-p (if (> cl-start 0) (nthcdr cl-start cl-seq)
-			  (setq cl-end (1- cl-end)) (cdr cl-seq))))
+			  (cl-decf cl-end) (cdr cl-seq))))
  	      (while (and cl-p (> cl-end 0)
  			  (not (cl--check-test cl-item (car cl-p))))
  		(setq cl-p (cdr cl-p) cl-end (1- cl-end)))
@@ -289,7 +289,7 @@ cl-delete
        (if (listp cl-seq)
  	  (if (and cl-from-end (< cl-count (/ len 2)))
  	      (let (cl-i)
-		(while (and (>= (setq cl-count (1- cl-count)) 0)
+		(while (and (>= (cl-decf cl-count) 0)
  			    (setq cl-i (cl--position cl-item cl-seq cl-start
  						     cl-end cl-from-end)))
  		  (if (= cl-i 0) (setq cl-seq (cdr cl-seq))
@@ -304,19 +304,19 @@ cl-delete
  			      (> cl-end 0)
  			      (cl--check-test cl-item (car cl-seq))
  			      (setq cl-end (1- cl-end) cl-seq (cdr cl-seq))
-			      (> (setq cl-count (1- cl-count)) 0)))
-		  (setq cl-end (1- cl-end)))
-	      (setq cl-start (1- cl-start)))
+			      (> (cl-decf cl-count) 0)))
+		  (cl-decf cl-end))
+	      (cl-decf cl-start))
  	    (if (and (> cl-count 0) (> cl-end 0))
  		(let ((cl-p (nthcdr cl-start cl-seq)))
  		  (while (and (cdr cl-p) (> cl-end 0))
  		    (if (cl--check-test cl-item (car (cdr cl-p)))
  			(progn
  			  (setcdr cl-p (cdr (cdr cl-p)))
-			  (if (= (setq cl-count (1- cl-count)) 0)
+			  (if (= (cl-decf cl-count) 0)
  			      (setq cl-end 1)))
  		      (setq cl-p (cdr cl-p)))
-		    (setq cl-end (1- cl-end)))))
+		    (cl-decf cl-end))))
  	    cl-seq)
  	(apply 'cl-remove cl-item cl-seq cl-keys))))))

@@ -367,7 +367,7 @@ cl--delete-duplicates
  				    cl-p (nthcdr cl-start cl-seq) cl-copy nil))
  		  (let ((cl-tail (nthcdr cl-i cl-p)))
  		    (setcdr cl-tail (cdr (cdr cl-tail))))
-		  (setq cl-end (1- cl-end)))
+		  (cl-decf cl-end))
  		(setq cl-p (cdr cl-p) cl-end (1- cl-end)
  		      cl-start (1+ cl-start)))
  	      cl-seq)
@@ -451,22 +451,22 @@ cl-nsubstitute
  		(if (cl--check-test cl-old (car cl-p))
  		    (progn
  		      (setcar cl-p cl-new)
-		      (setq cl-count (1- cl-count))))
+		      (cl-decf cl-count)))
  		(setq cl-p (cdr cl-p) cl-end (1- cl-end))))
  	    (or cl-end (setq cl-end len))
  	  (if cl-from-end
  	      (while (and (< cl-start cl-end) (> cl-count 0))
-		(setq cl-end (1- cl-end))
+		(cl-decf cl-end)
  		(if (cl--check-test cl-old (elt cl-seq cl-end))
  		    (progn
  		      (setf (elt cl-seq cl-end) cl-new)
-		      (setq cl-count (1- cl-count)))))
+		      (cl-decf cl-count))))
  	    (while (and (< cl-start cl-end) (> cl-count 0))
  	      (if (cl--check-test cl-old (aref cl-seq cl-start))
  		  (progn
  		    (aset cl-seq cl-start cl-new)
-		    (setq cl-count (1- cl-count))))
-	      (setq cl-start (1+ cl-start)))))))
+		    (cl-decf cl-count)))
+	      (cl-incf cl-start))))))
      cl-seq))

  ;;;###autoload
@@ -532,12 +532,12 @@ cl--position
      (or cl-end (setq cl-end (length cl-seq)))
      (if cl-from-end
  	(progn
-	  (while (and (>= (setq cl-end (1- cl-end)) cl-start)
+	  (while (and (>= (cl-decf cl-end) cl-start)
  		      (not (cl--check-test cl-item (aref cl-seq cl-end)))))
  	  (and (>= cl-end cl-start) cl-end))
        (while (and (< cl-start cl-end)
  		  (not (cl--check-test cl-item (aref cl-seq cl-start))))
-	(setq cl-start (1+ cl-start)))
+	(cl-incf cl-start))
        (and (< cl-start cl-end) cl-start))))

  ;;;###autoload
@@ -567,8 +567,8 @@ cl-count
        (if (consp cl-seq) (setq cl-seq (nthcdr cl-start cl-seq)))
        (while (< cl-start cl-end)
  	(setq cl-x (if (consp cl-seq) (pop cl-seq) (aref cl-seq cl-start)))
-	(if (cl--check-test cl-item cl-x) (setq cl-count (1+ cl-count)))
-	(setq cl-start (1+ cl-start)))
+	(if (cl--check-test cl-item cl-x) (cl-incf cl-count))
+	(cl-incf cl-start))
        cl-count)))

  ;;;###autoload
-- 
2.10.2

From e99ff85e4d54174931af24191457f1c5ad9bf79d Mon Sep 17 00:00:00 2001
From: Tino Calancha <tino.calancha@gmail.com>
Date: Thu, 10 Nov 2016 14:56:08 +0900
Subject: [PATCH 2/2] Use cl-incf and cl-decf on all files that require cl-lib

* lisp/abbrev.el (abbrev--check-chars): Use cl-incf and cl-decf.
* lisp/bookmark.el
(bookmark-maybe-rename, bookmark-menu-popup-paned-menu): Idem.
* lisp/calculator.el (calculator-groupize-number, calculator-eng-display)
(calculator-clear): Idem.
* lisp/calendar/todo-mode.el (todo-edit-item--diary-inclusion)
(todo-edit-category-diary-inclusion, todo-set-item-priority, todo-move-item)
(todo-item-done, todo-item-undone, todo-archive-done-item)
(todo-unarchive-items, todo-find-item, todo-check-filtered-items-file)
(todo-print-buffer, todo-make-categories-list, todo-prefix-overlays): Idem.
* lisp/desktop.el (desktop-save, desktop-create-buffer): Idem.
* lisp/dired-aux.el (dired-kill-line, dired-do-kill-lines)
(dired-create-files, dired-hide-subdir): Idem.
* lisp/doc-view.el (doc-view-search-internal): Idem.
* lisp/emacs-lisp/advice.el (ad-enable-advice-internal, ad-set-arguments)
(ad-map-arglists, ad-with-originals): Idem.
* lisp/emacs-lisp/avl-tree.el (avl-tree-size): Idem.
* lisp/emacs-lisp/byte-opt.el (byte-optimize-nthcdr, disassemble-offset)
(byte-decompile-bytecode-1, byte-optimize-lapcode): Idem.
* lisp/emacs-lisp/cconv.el (cconv--convert-function): Idem.
* lisp/emacs-lisp/cl.el (cl-struct-setf-expander): Idem.
* lisp/emacs-lisp/edebug.el (edebug-read-syntax-table): Idem.
* lisp/emacs-lisp/ewoc.el (ewoc--node-nth, ewoc-goto-next): Idem.
* lisp/emacs-lisp/lisp-mode.el (lisp--mode-syntax-table)
(lisp-string-in-doc-position-p, lisp-indent-specform): Idem.
* lisp/emacs-lisp/map.el (map--apply-array): Idem.
* lisp/emacs-lisp/seq.el (seq-do-indexed, seq-sort-by)
(seq--make-pcase-bindings, seq--elt-safe): Idem.
* lisp/epg.el (epg--list-keys-1): Idem.
* lisp/erc/erc-track.el (erc-unique-substrings): Idem.
* lisp/erc/erc.el (erc-parse-prefix): Idem.
* lisp/eshell/em-cmpl.el (eshell-complete-parse-arguments): Idem.
* lisp/eshell/em-hist.el (eshell-read-history, eshell-list-history)
(eshell-complete-history-reference): Idem.
* lisp/eshell/em-ls.el (eshell-ls-find-column-widths)
(eshell-ls-find-column-lengths): Idem.
* lisp/eshell/em-term.el (eshell-term-sentinel): Idem.
* lisp/eshell/esh-io.el (eshell-protect-handles)
(eshell-close-handles): Idem.
* lisp/eshell/esh-util.el (eshell-find-delimiter, eshell-split-path)
(eshell-read-host-names): Idem.
* lisp/font-lock.el (font-lock-after-change-function): Idem.
* lisp/frame.el (handle-delete-frame, blink-cursor-timer-function): Idem.
* lisp/help-fns.el (describe-categories): Idem.
* lisp/hexl.el (hexl-mode, hexl-mode-exit, hexl-backward-short)
(hexl-backward-word, hexl-insert-multibyte-char, hexl-insert-char): Idem.
* lisp/ibuffer.el (ibuffer-mark-interactive, filename-and-process): Idem.
* lisp/image-dired.el (image-dired-slideshow-step)
(image-dired-gallery-generate): Idem.
* lisp/image-mode.el (image-next-file): Idem.
* lisp/info.el (Info-follow-reference, Info-prev-reference)
(Info-menu-update)
(Info-breadcrumbs, Info-fontify-node): Idem.
* lisp/international/mule-cmds.el (find-multibyte-characters)
(ucs-names): Idem.
* lisp/international/quail.el (quail-translation-keymap)
(quail-simple-translation-keymap, quail-conversion-keymap)
(quail-update-keyboard-layout, quail-keyboard-translate)
(quail-insert-kbd-layout, quail-defrule-internal, quail-lookup-key)
(quail-update-translation, quail-update-current-translations)
(quail-translate-key, quail-get-translations)
(quail-completion-list-translations, quail-build-decode-map): Idem.
* lisp/isearch.el (isearch-mode-map, isearch-lazy-highlight-update): Idem.
* lisp/leim/quail/latin-ltx.el (latin-ltx--define-rules): Idem.
* lisp/mail/footnote.el (Footnote-english-upper)
(Footnote-refresh-footnotes, Footnote-assoc-index)
(Footnote-text-under-cursor, Footnote-make-hole)
(Footnote-renumber-footnotes): Idem.
* lisp/minibuffer.el (completion--replace, completion--insert-strings)
(completion--sifn-requote, completion-pcm--merge-completions): Idem.
* lisp/net/dbus.el (dbus-register-signal): Idem.
* lisp/net/eudc.el (eudc-extract-n-word-formats): Idem.
* lisp/net/eww.el (eww-make-unique-file-name): Idem.
* lisp/net/mailcap.el (mailcap-parse-mailcap-extras): Idem.
* lisp/net/pinentry.el (pinentry--escape-string)
(pinentry--unescape-string): Idem.
* lisp/net/rcirc.el (rcirc-insert-prev-input, rcirc-print): Idem.
* lisp/nxml/nxml-mode.el (nxml-forward-balanced-item)
(nxml-backward-up-element, nxml-down-element)
(nxml-backward-down-element, nxml-forward-element)
(nxml-backward-element, nxml-forward-paragraph)
(nxml-backward-paragraph, nxml-preceding-sibling-data-p)
(nxml-following-sibling-data-p): Idem.
* lisp/nxml/rng-match.el (rng-ipattern-clear): Idem.
* lisp/obsolete/landmark.el (landmark-strongest-square, landmark-play-move)
(landmark-number-of-draws, landmark-init-display)
(landmark-check-filled-qtuple)
(landmark-cross-qtuple): Idem.
* lisp/play/pong.el (pong-move-left, pong-move-up, pong-move-down)
(pong-update-game): Idem.
* lisp/play/tetris.el (tetris-shift-row, tetris-reset-game)
(tetris-update-game, tetris-move-bottom, tetris-move-left)
(tetris-move-right)
(tetris-move-down): Idem.
* lisp/progmodes/elisp-mode.el (elisp--highlight-function-argument)
(elisp--beginning-of-sexp): Idem.
* lisp/progmodes/flymake.el (flymake-create-master-file)
(flymake-get-line-err-count, flymake-get-err-count)
(flymake-fix-line-numbers)
(flymake-parse-err-lines, flymake-find-err-info, flymake-add-line-err-info)
(flymake-get-project-include-dirs-imp, flymake-get-next-err-line-no)
(flymake-get-prev-err-line-no, flymake-get-full-patched-file-name)
(flymake-get-full-nonpatched-file-name): Idem.
* lisp/progmodes/gdb-mi.el (gdb-send, gdb-input)
(gdbmi-bnf-skip-unrecognized, gdbmi-bnf-result-and-async-record-impl)
(gdbmi-bnf-incomplete-record-result): Idem.
* lisp/progmodes/hideif.el (hif-get-argument-list, next-ifdef)
(previous-ifdef): Idem.
* lisp/progmodes/js.el (js--re-search-forward-inner)
(js--re-search-backward-inner): Idem.
* lisp/progmodes/python.el (python-syntax-count-quotes)
(python-nav--forward-defun, python-nav-forward-statement)
(python-nav-forward-block, python-nav-forward-sexp)
(python-nav-up-list): Idem.
* lisp/progmodes/sh-script.el (sh-find-prev-matching)
(sh-learn-buffer-indent, sh-guess-basic-offset, sh-guess-basic-offset): Idem.
* lisp/progmodes/sql.el (sql-redirect-value): Idem.
* lisp/rect.el (rectangle--highlight-for-redisplay): Idem.
* lisp/replace.el (how-many, occur-find-match, occur-1, occur-engine)
(perform-replace): Idem.
* lisp/server.el (server-handle-delete-frame): Idem.
* lisp/ses.el (ses-load, ses-yank-tsf, ses-mark-column, ses-end-of-line)
(ses-center-span): Idem.
* lisp/simple.el (open-line, count-words, execute-extended-command--shorter)
(primitive-undo, backward-delete-char-untabify, forward-visible-line)
(line-move-1, transpose-lines, next-completion)
(choose-completion-guess-base-position): Idem.
* lisp/skeleton.el (skeleton-insert): Idem.
* lisp/subr.el (dotimes, looking-back, subst-char-in-string)
(collapse-delayed-warnings, forward-whitespace, forward-symbol)
(forward-same-syntax, called-interactively-p): Idem.
* lisp/tar-mode.el (tar-parse-octal-long-integer): Idem.
* lisp/term/x-win.el (vendor-specific-keysyms): Idem.
* lisp/textmodes/flyspell.el (vendor-specific-keysyms)
(flyspell-maybe-correct-transposition)
(flyspell-maybe-correct-doubling): Idem.
* lisp/textmodes/ispell.el (ispell-command-loop, ispell-parse-output): Idem.
* lisp/textmodes/sgml-mode.el (sgml-mode-map, sgml-slash-matching)
(sgml-attributes, sgml-skip-tag-backward, sgml-skip-tag-forward)
(sgml-delete-tag): Idem.
* lisp/textmodes/tex-mode.el (tex-validate-buffer): Idem.
* lisp/thumbs.el (thumbs-do-thumbs-insertion): Idem.
* lisp/uniquify.el (uniquify-get-proposed-name): Idem.
* lisp/url/url-http.el (url-http-parse-headers): Idem.
* lisp/vc/ediff-init.el (ediff-nonempty-string-p): Idem.
* lisp/vc/vc-annotate.el (vc-annotate-warp-revision): Idem.
* lisp/wid-edit.el (widget-choose, widget-move, widget-field-text-end)
(widget-field-value-get): Idem.
* lisp/woman.el (woman-topic-all-completions, WoMan-next-manpage)
(woman-horizontal-escapes, woman-interpolate-macro)
(woman-display-extended-fonts, woman-negative-vertical-space): Idem.
---
  lisp/abbrev.el                  |  2 +-
  lisp/bookmark.el                |  6 +++---
  lisp/calculator.el              |  8 ++++----
  lisp/calendar/todo-mode.el      | 32 ++++++++++++++++----------------
  lisp/desktop.el                 |  6 +++---
  lisp/dired-aux.el               | 10 +++++-----
  lisp/doc-view.el                |  2 +-
  lisp/emacs-lisp/advice.el       | 24 ++++++++++++------------
  lisp/emacs-lisp/avl-tree.el     |  2 +-
  lisp/emacs-lisp/byte-opt.el     | 18 +++++++++---------
  lisp/emacs-lisp/cconv.el        |  2 +-
  lisp/emacs-lisp/cl.el           |  2 +-
  lisp/emacs-lisp/edebug.el       |  8 ++++----
  lisp/emacs-lisp/ewoc.el         |  8 ++++----
  lisp/emacs-lisp/lisp-mode.el    | 12 ++++++------
  lisp/emacs-lisp/map.el          |  2 +-
  lisp/emacs-lisp/seq.el          | 10 +++++-----
  lisp/epg.el                     |  2 +-
  lisp/erc/erc-track.el           |  4 ++--
  lisp/erc/erc.el                 |  2 +-
  lisp/eshell/em-cmpl.el          |  2 +-
  lisp/eshell/em-hist.el          |  8 ++++----
  lisp/eshell/em-ls.el            |  4 ++--
  lisp/eshell/em-term.el          |  2 +-
  lisp/eshell/esh-io.el           |  4 ++--
  lisp/eshell/esh-util.el         |  6 +++---
  lisp/font-lock.el               |  2 +-
  lisp/frame.el                   |  8 ++++----
  lisp/help-fns.el                |  4 ++--
  lisp/hexl.el                    | 20 ++++++++++----------
  lisp/ibuffer.el                 | 10 +++++-----
  lisp/image-dired.el             |  8 ++++----
  lisp/image-mode.el              |  2 +-
  lisp/info.el                    | 14 +++++++-------
  lisp/international/mule-cmds.el |  6 +++---
  lisp/international/quail.el     | 40 ++++++++++++++++++++--------------------
  lisp/isearch.el                 |  6 +++---
  lisp/leim/quail/latin-ltx.el    |  4 ++--
  lisp/mail/footnote.el           | 20 ++++++++++----------
  lisp/minibuffer.el              | 10 +++++-----
  lisp/net/dbus.el                |  2 +-
  lisp/net/eudc.el                |  2 +-
  lisp/net/eww.el                 |  2 +-
  lisp/net/mailcap.el             |  2 +-
  lisp/net/pinentry.el            | 20 ++++++++++----------
  lisp/net/rcirc.el               |  6 +++---
  lisp/nxml/nxml-mode.el          | 28 ++++++++++++++--------------
  lisp/nxml/rng-match.el          |  2 +-
  lisp/obsolete/landmark.el       | 28 ++++++++++++++--------------
  lisp/play/pong.el               | 12 ++++++------
  lisp/play/tetris.el             | 24 ++++++++++++------------
  lisp/progmodes/elisp-mode.el    |  4 ++--
  lisp/progmodes/flymake.el       | 30 +++++++++++++++---------------
  lisp/progmodes/gdb-mi.el        | 14 +++++++-------
  lisp/progmodes/hideif.el        | 10 +++++-----
  lisp/progmodes/js.el            |  4 ++--
  lisp/progmodes/python.el        | 22 +++++++++++-----------
  lisp/progmodes/sh-script.el     | 12 ++++++------
  lisp/progmodes/sql.el           |  4 ++--
  lisp/rect.el                    |  4 ++--
  lisp/replace.el                 | 18 +++++++++---------
  lisp/server.el                  |  2 +-
  lisp/ses.el                     | 12 ++++++------
  lisp/simple.el                  | 30 +++++++++++++++---------------
  lisp/skeleton.el                |  4 ++--
  lisp/subr.el                    | 24 ++++++++++++------------
  lisp/tar-mode.el                |  4 ++--
  lisp/term/x-win.el              |  2 +-
  lisp/textmodes/flyspell.el      |  8 ++++----
  lisp/textmodes/ispell.el        |  6 +++---
  lisp/textmodes/sgml-mode.el     | 16 ++++++++--------
  lisp/textmodes/tex-mode.el      |  2 +-
  lisp/thumbs.el                  |  2 +-
  lisp/uniquify.el                |  2 +-
  lisp/url/url-http.el            |  2 +-
  lisp/vc/ediff-init.el           |  2 +-
  lisp/vc/vc-annotate.el          |  4 ++--
  lisp/wid-edit.el                | 20 ++++++++++----------
  lisp/woman.el                   | 16 ++++++++--------
  79 files changed, 375 insertions(+), 375 deletions(-)

diff --git a/lisp/abbrev.el b/lisp/abbrev.el
index b6d202c..19f550d 100644
--- a/lisp/abbrev.el
+++ b/lisp/abbrev.el
@@ -617,7 +617,7 @@ abbrev--check-chars
              (pos 0))
          (while (string-match "\\W" abbrev pos)
            (cl-pushnew (aref abbrev (match-beginning 0)) badchars)
-          (setq pos (1+ pos)))
+          (cl-incf pos))
          (error "Some abbrev characters (%s) are not word constituents %s"
                 (apply 'string (nreverse badchars))
                 (if global "in the standard syntax" "in this mode"))))))
diff --git a/lisp/bookmark.el b/lisp/bookmark.el
index f3c8b2a..d917203 100644
--- a/lisp/bookmark.el
+++ b/lisp/bookmark.el
@@ -1466,7 +1466,7 @@ bookmark-maybe-rename
                (new-name found-name))
            (while (member new-name names)
              (setq new-name (concat found-name (format "<%d>" count)))
-            (setq count (1+ count)))
+            (cl-incf count))
            (bookmark-set-name full-record new-name)))))


@@ -2162,8 +2162,8 @@ bookmark-menu-popup-paned-menu
  		   str)
  		  lst)
  	    (setq entries (cdr entries))
-	    (setq count (1+ count))))
-	(setq iter (1+ iter))
+	    (cl-incf count)))
+	(cl-incf iter)
  	(push (cons
  	       (format "-*- %s (%d) -*-" name iter)
  	       (nreverse lst))
diff --git a/lisp/calculator.el b/lisp/calculator.el
index 523bf98..68f2f4c 100644
--- a/lisp/calculator.el
+++ b/lisp/calculator.el
@@ -962,7 +962,7 @@ calculator-groupize-number
      (while (> i 0)
        (let* ((e (* i n)) (e (if fromleft e (+ e j))))
          (push (substring str (- e n) e) r))
-      (setq i (1- i)))
+      (cl-decf i))
      (when (and (not fromleft) (> j 0))
        (push (substring str 0 j) r))
      (mapconcat 'identity r sep)))
@@ -1028,10 +1028,10 @@ calculator-eng-display
            (let ((i calculator-eng-extra))
              (while (> i 0)
                (setq num (* num 1000.0)) (setq exp (- exp 3))
-              (setq i (1- i)))
+              (cl-decf i))
              (while (< i 0)
                (setq num (/ num 1000.0)) (setq exp (+ exp 3))
-              (setq i (1+ i))))))
+              (cl-incf i)))))
        (unless calculator-eng-tmp-show (setq calculator-eng-extra nil))
        (let ((str (format (format "%%.%sf" calculator-number-digits)
                           num)))
@@ -1443,7 +1443,7 @@ calculator-clear
         (let ((p (nthcdr (1- calculator-saved-ptr)
                          calculator-saved-list)))
           (setcdr p (cddr p))
-         (setq calculator-saved-ptr (1- calculator-saved-ptr))))
+         (cl-decf calculator-saved-ptr)))
       (if calculator-saved-list
         (setq calculator-stack
               (list (nth calculator-saved-ptr calculator-saved-list)))
diff --git a/lisp/calendar/todo-mode.el b/lisp/calendar/todo-mode.el
index aee101f..27952e1 100644
--- a/lisp/calendar/todo-mode.el
+++ b/lisp/calendar/todo-mode.el
@@ -2436,7 +2436,7 @@ todo-edit-item--diary-inclusion
  		  (when end
  		    (when (looking-at (regexp-quote diary-nonmarking-symbol))
  		      (replace-match "")
-		      (setq end (1- end))) ; Since we deleted nonmarking symbol.
+		      (cl-decf end)) ; Since we deleted nonmarking symbol.
  		    (insert todo-nondiary-start)
  		    (goto-char (1+ end))
  		    (insert todo-nondiary-end)
@@ -2468,7 +2468,7 @@ todo-edit-category-diary-inclusion
  		  (unless (looking-at (regexp-quote todo-nondiary-start))
  		    (when (looking-at (regexp-quote diary-nonmarking-symbol))
  		      (replace-match "")
-		      (setq end (1- end))) ; Since we deleted nonmarking symbol.
+		      (cl-decf end)) ; Since we deleted nonmarking symbol.
  		    (insert todo-nondiary-start)
  		    (goto-char (1+ end))
  		    (insert todo-nondiary-end))
@@ -2541,7 +2541,7 @@ todo-set-item-priority
  				(count 0))
  			    (goto-char (point-min))
  			    (while (looking-at todo-item-start)
-			      (setq count (1+ count))
+			      (cl-incf count)
  			      (when (= (point) curstart) (setq curnum count))
  			      (todo-forward-item))
  			    count)))
@@ -2711,7 +2711,7 @@ todo-move-item
  					     (todo-item-string) "\n")
  			  todo (1+ todo))
  		    (when (todo-diary-item-p)
-		      (setq diary (1+ diary)))))
+		      (cl-incf diary))))
  		(todo-forward-item))
  	      ;; Chop off last newline of multiple todo item string,
  	      ;; since it will be reinserted when setting priority
@@ -2849,9 +2849,9 @@ todo-item-done
  		  (setq item (todo-item-string))
  		  (setq done-item (concat done-item done-prefix item
  					  comment (and marked "\n")))
-		  (setq item-count (1+ item-count))
+		  (cl-incf item-count)
  		  (when (todo-diary-item-p)
-		    (setq diary-count (1+ diary-count)))
+		    (cl-incf diary-count))
  		  (todo-remove-item)
  		  (unless marked (throw 'done nil)))
  	      (todo-forward-item))))
@@ -2917,9 +2917,9 @@ todo-item-undone
  		;; Find the end of the date string added upon tagging item as
  		;; done.
  		(setq start (search-forward "] "))
-		(setq item-count (1+ item-count))
+		(cl-incf item-count)
  		(unless (looking-at (regexp-quote todo-nondiary-start))
-		  (setq diary-count (1+ diary-count)))
+		  (cl-incf diary-count))
  		(setq end (save-excursion (todo-item-end)))
  		;; Ask (once) whether to omit done item's comment.  If
  		;; affirmed, omit subsequent comments without asking.
@@ -3087,7 +3087,7 @@ todo-archive-done-item
  		      (throw 'end (message "Only done items can be archived"))
  		    (setq marked-items
  			  (concat marked-items (todo-item-string) "\n"))
-		    (setq count (1+ count))))
+		    (cl-incf count)))
  		(todo-forward-item)))))
  	  (if (not (or marked all item))
  	      (throw 'end (message "Only done items can be archived"))
@@ -3194,7 +3194,7 @@ todo-unarchive-items
  	  (while (not (eobp))
  	    (when (todo-marked-item-p)
  	      (setq marked-items (concat marked-items (todo-item-string) "\n"))
-	      (setq marked-count (1+ marked-count)))
+	      (cl-incf marked-count))
  	    (todo-forward-item))))
        ;; Restore items to top of category's done section and update counts.
        (with-current-buffer tbuf
@@ -4361,7 +4361,7 @@ todo-find-item
        ;; Calculate priority of STR wrt its category.
        (save-excursion
  	(while (search-backward filcat nil t)
-	    (setq tpriority (1+ tpriority)))))
+	    (cl-incf tpriority))))
      (setq file (if file
  		   (concat todo-directory (substring file 0 -1)
  			   (if archive ".toda" ".todo"))
@@ -4405,7 +4405,7 @@ todo-find-item
  					  ;; Can't move backward beyond
  					  ;; first item in file.
  					  (unless (= (point) opoint)
-					    (setq cpriority (1+ cpriority)))))))
+					    (cl-incf cpriority))))))
  				  (if (and (= tpriority cpriority)
  					   ;; Proper substring is not the same.
  					   (string= (todo-item-string)
@@ -4425,7 +4425,7 @@ todo-check-filtered-items-file
  	  (save-excursion
  	    (overlay-put (make-overlay (todo-item-start) (todo-item-end))
  			 'face 'todo-search))
-	  (setq count (1+ count))))
+	  (cl-incf count)))
  	  ;; (throw 'old (message "The marked item is not up to date.")))
        (todo-forward-item))
      (if (zerop count)
@@ -4499,7 +4499,7 @@ todo-print-buffer
  	(let ((beg (point))
  	      (end (save-excursion (todo-item-end))))
  	  (when todo-number-prefix
-	    (setq num (1+ num))
+	    (cl-incf num)
  	    (setq prefix (propertize (concat (number-to-string num) " ")
  				     'face 'todo-prefix-string)))
  	  (insert prefix)
@@ -4971,7 +4971,7 @@ todo-make-categories-list
  					       "\\(.*\\)\n"))
  					     (eobp)))
  			       (when (looking-at todo-done-string-start)
-				 (setq archive-count (1+ archive-count)))
+				 (cl-incf archive-count))
  			       (forward-line)))))
  		       (unless visiting (kill-buffer)))
  		     (todo-update-count 'archived archive-count cat))))
@@ -5358,7 +5358,7 @@ todo-prefix-overlays
  	(when (or (todo-date-string-matcher (line-end-position))
  		  (todo-done-string-matcher (line-end-position)))
  	  (goto-char (match-beginning 0))
-	  (setq num (1+ num))
+	  (cl-incf num)
  	  ;; Reset number to 1 for first done item.
  	  (when (and (eq major-mode 'todo-mode)
  		     (looking-at todo-done-string-start)
diff --git a/lisp/desktop.el b/lisp/desktop.el
index 9fb8393..cbc4af5 100644
--- a/lisp/desktop.el
+++ b/lisp/desktop.el
@@ -1104,7 +1104,7 @@ desktop-save
  			(if (or (not (integerp eager))
  				(if (zerop eager)
  				    nil
-				  (setq eager (1- eager))))
+				  (cl-decf eager)))
  			    "desktop-create-buffer"
  			  "desktop-append-buffer-args")
  			" "
@@ -1479,8 +1479,8 @@ desktop-create-buffer
  		(when desktop-missing-file-warning (sit-for 1))
  		nil))))
  	(if (bufferp result)
-	    (setq desktop-buffer-ok-count (1+ desktop-buffer-ok-count))
-	  (setq desktop-buffer-fail-count (1+ desktop-buffer-fail-count))
+	    (cl-incf desktop-buffer-ok-count)
+	  (cl-incf desktop-buffer-fail-count)
  	  (setq result nil))
  	;; Restore buffer list order with new buffer at end. Don't change
  	;; the order for old desktop files (old desktop module behavior).
diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el
index 972b6b1..8d25980 100644
--- a/lisp/dired-aux.el
+++ b/lisp/dired-aux.el
@@ -878,8 +878,8 @@ dired-kill-line
  	(delete-region (line-beginning-position)
  		       (progn (forward-line 1) (point)))
  	(if (> arg 0)
-	    (setq arg (1- arg))
-	  (setq arg (1+ arg))
+	    (cl-decf arg)
+	  (cl-incf arg)
  	  (forward-line -1))))
      (dired-move-to-filename)))

@@ -908,7 +908,7 @@ dired-do-kill-lines
  	    (regexp (dired-marker-regexp)))
  	(while (and (not (eobp))
  		    (re-search-forward regexp nil t))
-	  (setq count (1+ count))
+	  (cl-incf count)
  	  (delete-region (line-beginning-position)
  			 (progn (forward-line 1) (point))))
  	(or (equal "" fmt)
@@ -1714,7 +1714,7 @@ dired-create-files
                        ;; and the old entry (if any) has to be deleted
                        ;; before adding the new entry.
                        (dired-remove-file to))
-                  (setq success-count (1+ success-count))
+                  (cl-incf success-count)
                    (message "%s: %d of %d" operation success-count total)
                    (dired-add-file to actual-marker-char))
                (file-error		; FILE-CREATOR aborted
@@ -2615,7 +2615,7 @@ dired-hide-subdir
    (interactive "p")
    (dired-hide-check)
    (let ((modflag (buffer-modified-p)))
-    (while (>=  (setq arg (1- arg)) 0)
+    (while (>=  (cl-decf arg) 0)
        (let* ((cur-dir (dired-current-directory))
  	     (hidden-p (dired-subdir-hidden-p cur-dir))
  	     (elt (assoc cur-dir dired-subdir-alist))
diff --git a/lisp/doc-view.el b/lisp/doc-view.el
index 223565c..ba938cb 100644
--- a/lisp/doc-view.el
+++ b/lisp/doc-view.el
@@ -1483,7 +1483,7 @@ doc-view-search-internal
  	  matches)
        (while (re-search-forward (concat "\\(?:\\([\f]\\)\\|\\("
  					regexp "\\)\\)") nil t)
-	(when (match-string 1) (setq page (1+ page)))
+	(when (match-string 1) (cl-incf page))
  	(when (match-string 2)
  	  (if (/= page lastpage)
  	      (push (cons page
diff --git a/lisp/emacs-lisp/advice.el b/lisp/emacs-lisp/advice.el
index c0da59c..60d6a3f 100644
--- a/lisp/emacs-lisp/advice.el
+++ b/lisp/emacs-lisp/advice.el
@@ -857,7 +857,7 @@
  ;;
  ;; (defadvice foo (before fg-add2 first activate)
  ;;   "Add 2 to X."
-;;   (setq x (1+ x)))
+;;   (cl-incf x))
  ;; foo
  ;;
  ;; (foo 3)
@@ -877,7 +877,7 @@
  ;;
  ;; (defadvice foo (before fg-cancel-add2 0 activate)
  ;;   "Again only add 1 to X."
-;;   (setq x (1- x)))
+;;   (cl-decf x))
  ;; foo
  ;;
  ;; (foo 3)
@@ -895,7 +895,7 @@
  ;;
  ;; (defadvice foo (before fg-cancel-add2 last act)
  ;;   "Again only add 1 to X."
-;;   (setq x (1- x)))
+;;   (cl-decf x))
  ;; foo
  ;;
  ;; @@ Assembly of advised documentation:
@@ -1141,7 +1141,7 @@
  ;;
  ;; (defadvice foo (before fg-1-more dis)
  ;;   "Add yet 1 more."
-;;   (setq x (1+ x)))
+;;   (cl-incf x))
  ;; foo
  ;;
  ;; (ad-activate 'foo)
@@ -1195,7 +1195,7 @@
  ;;
  ;; (defadvice bar (before fg-sub-1-more act)
  ;;   "Subtract one more from X."
-;;   (setq x (1- x)))
+;;   (cl-decf x))
  ;; bar
  ;;
  ;; `bar' is not yet defined:
@@ -1986,7 +1986,7 @@ ad-enable-advice-internal
  				(string-match
  				 name (symbol-name (ad-advice-name advice))))
  			   (eq name (ad-advice-name advice)))
-		       (setq matched-advices (1+ matched-advices))
+		       (cl-incf matched-advices)
  		       (ad-advice-set-enabled advice flag))))))
  	matched-advices)))

@@ -2359,8 +2359,8 @@ ad-set-arguments
                                     (car (cdr argument-access)))
                    ,(ad-list-access values-index 'ad-vAlUeS))))
              set-forms)
-      (setq index (1+ index))
-      (setq values-index (1+ values-index)))
+      (cl-incf index)
+      (cl-incf values-index))
      (if (null set-forms)
  	(error "ad-set-arguments: No argument at position %d of `%s'"
  	       index arglist)
@@ -2439,7 +2439,7 @@ ad-map-arglists
  		   ;; `apply' can take care of that directly:
  		   (append source-reqopt-args (list source-rest-arg)))
  		  (t (mapcar (lambda (_arg)
-                               (setq target-arg-index (1+ target-arg-index))
+                               (cl-incf target-arg-index)
                                 (ad-get-argument
                                  source-arglist target-arg-index))
  			     (append target-reqopt-args
@@ -3227,7 +3227,7 @@ ad-with-originals
  	 (current-bindings
  	  (mapcar (function
  		   (lambda (function)
-                    (setq index (1+ index))
+                    (cl-incf index)
                      (list (intern (format "ad-oRiGdEf-%d" index))
                            `(symbol-function ',function))))
  		  functions)))
@@ -3239,7 +3239,7 @@ ad-with-originals
                  ;; original definitions if they are advised:
                  (setq index -1)
                  (mapcar (lambda (function)
-                          (setq index (1+ index))
+                          (cl-incf index)
                             `(fset ',function
                              (or (ad-get-orig-definition ',function)
                                  ,(car (nth index current-bindings)))))
@@ -3250,7 +3250,7 @@ ad-with-originals
             ;; they had outside this macro call:
             (setq index -1)
             (mapcar (lambda (function)
-                     (setq index (1+ index))
+                     (cl-incf index)
                         `(fset ',function
                         ,(car (nth index current-bindings))))
                     functions))))))
diff --git a/lisp/emacs-lisp/avl-tree.el b/lisp/emacs-lisp/avl-tree.el
index 707d1cb..5c62393 100644
--- a/lisp/emacs-lisp/avl-tree.el
+++ b/lisp/emacs-lisp/avl-tree.el
@@ -603,7 +603,7 @@ avl-tree-size
    "Return the number of elements in TREE."
    (let ((treesize 0))
      (avl-tree--mapc
-     (lambda (_) (setq treesize (1+ treesize)))
+     (lambda (_) (cl-incf treesize))
       (avl-tree--root tree) 0)
      treesize))

diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el
index 610c3b6..f67195f 100644
--- a/lisp/emacs-lisp/byte-opt.el
+++ b/lisp/emacs-lisp/byte-opt.el
@@ -1132,7 +1132,7 @@ byte-optimize-nthcdr
        (if (memq (nth 1 form) '(0 1 2))
  	  (let ((count (nth 1 form)))
  	    (setq form (nth 2 form))
-	    (while (>= (setq count (1- count)) 0)
+	    (while (>= (cl-decf count) 0)
  	      (setq form (list 'cdr form)))
  	    form)
  	(byte-optimize-predicate form))
@@ -1304,13 +1304,13 @@ disassemble-offset
  	   (setq bytedecomp-op (logand bytedecomp-op 248))
  	   (cond ((eq tem 6)
  		  ;; Offset in next byte.
-		  (setq bytedecomp-ptr (1+ bytedecomp-ptr))
+		  (cl-incf bytedecomp-ptr)
  		  (aref bytes bytedecomp-ptr))
  		 ((eq tem 7)
  		  ;; Offset in next 2 bytes.
-		  (setq bytedecomp-ptr (1+ bytedecomp-ptr))
+		  (cl-incf bytedecomp-ptr)
  		  (+ (aref bytes bytedecomp-ptr)
-		     (progn (setq bytedecomp-ptr (1+ bytedecomp-ptr))
+		     (progn (cl-incf bytedecomp-ptr)
  			    (lsh (aref bytes bytedecomp-ptr) 8))))
  		 (t tem))))		;Offset was in opcode.
  	((>= bytedecomp-op byte-constant)
@@ -1322,13 +1322,13 @@ disassemble-offset
                                     (list byte-stack-set2 byte-pushcatch
                                           byte-pushconditioncase))))
  	 ;; Offset in next 2 bytes.
-	 (setq bytedecomp-ptr (1+ bytedecomp-ptr))
+	 (cl-incf bytedecomp-ptr)
  	 (+ (aref bytes bytedecomp-ptr)
-	    (progn (setq bytedecomp-ptr (1+ bytedecomp-ptr))
+	    (progn (cl-incf bytedecomp-ptr)
  		   (lsh (aref bytes bytedecomp-ptr) 8))))
  	((and (>= bytedecomp-op byte-listN)
  	      (<= bytedecomp-op byte-discardN))
-	 (setq bytedecomp-ptr (1+ bytedecomp-ptr)) ;Offset in next byte.
+	 (cl-incf bytedecomp-ptr) ;Offset in next byte.
  	 (aref bytes bytedecomp-ptr))))

  (defvar byte-compile-tag-number)
@@ -1398,7 +1398,7 @@ byte-decompile-bytecode-1
        ;; lap = ( [ (pc . (op . arg)) ]* )
        (push (cons optr (cons bytedecomp-op (or offset 0)))
              lap)
-      (setq bytedecomp-ptr (1+ bytedecomp-ptr)))
+      (cl-incf bytedecomp-ptr))
      (let ((rest lap))
        (while rest
  	(cond ((numberp (car rest)))
@@ -1689,7 +1689,7 @@ byte-optimize-lapcode
  		      (setq tmp (cdr rest))
                        (setq tmp2 0)
  		      (while (eq (car (car tmp)) 'byte-dup)
-			(setq tmp2 (1+ tmp2))
+			(cl-incf tmp2)
                          (setq tmp (cdr tmp)))
  		      t)
  		    (eq (if (eq 'byte-stack-ref (car lap0))
diff --git a/lisp/emacs-lisp/cconv.el b/lisp/emacs-lisp/cconv.el
index 46b5a7f..2b58a93 100644
--- a/lisp/emacs-lisp/cconv.el
+++ b/lisp/emacs-lisp/cconv.el
@@ -223,7 +223,7 @@ cconv--convert-function
            (_
             (push exp envector)
             (push `(,fv . (internal-get-closed-var ,i)) new-env))))
-      (setq i (1+ i)))
+      (cl-incf i))
      (setq envector (nreverse envector))
      (setq new-env (nreverse new-env))

diff --git a/lisp/emacs-lisp/cl.el b/lisp/emacs-lisp/cl.el
index c3d3fea..84d04b2 100644
--- a/lisp/emacs-lisp/cl.el
+++ b/lisp/emacs-lisp/cl.el
@@ -711,7 +711,7 @@ cl-struct-setf-expander
                  `(setcar
                    ,(if (<= pos 5)
                         (let ((xx temp))
-                         (while (>= (setq pos (1- pos)) 0)
+                         (while (>= (cl-decf pos) 0)
                             (setq xx `(cdr ,xx)))
                           xx)
                       `(nthcdr ,pos ,temp))
diff --git a/lisp/emacs-lisp/edebug.el b/lisp/emacs-lisp/edebug.el
index db78d94..968e3c2 100644
--- a/lisp/emacs-lisp/edebug.el
+++ b/lisp/emacs-lisp/edebug.el
@@ -666,7 +666,7 @@ edebug-read-syntax-table
  	(i 0))
      (while (< i ?!)
        (aset table i 'space)
-      (setq i (1+ i)))
+      (cl-incf i))
      (aset table ?\( 'lparen)
      (aset table ?\) 'rparen)
      (aset table ?\' 'quote)
@@ -2897,7 +2897,7 @@ edebug-find-stop-point
      (setq len (length offset-vector))
      (setq i 0)
      (while (and (< i len) (> offset (aref offset-vector i)))
-      (setq i (1+ i)))
+      (cl-incf i))
      (if (and (< i len)
  	     (<= offset (aref offset-vector i)))
  	;; return the relevant info
@@ -3890,7 +3890,7 @@ edebug-display-freq-count
  	      last-index i)

  	;; Find all indexes on same line.
-	(while (and (<= 0 (setq i (1- i)))
+	(while (and (<= 0 (cl-decf i))
  		    (<= start-of-line (aref edebug-points i))))
  	;; Insert all the indices for this line.
  	(forward-line 1)
@@ -3899,7 +3899,7 @@ edebug-display-freq-count
  	      last-count -1)  ; Cause first count to always appear.
  	(insert ";#")
  	;; i == first-index still
-	(while (<= (setq i (1+ i)) last-index)
+	(while (<= (cl-incf i) last-index)
  	  (let ((count (aref counts i))
  		(coverage (aref coverages i))
  		(col (save-excursion
diff --git a/lisp/emacs-lisp/ewoc.el b/lisp/emacs-lisp/ewoc.el
index 932b7fb..34556af 100644
--- a/lisp/emacs-lisp/ewoc.el
+++ b/lisp/emacs-lisp/ewoc.el
@@ -130,7 +130,7 @@ ewoc--node-nth
      (if (< n 0) (setq n (- -1 n)))
      (while (and (not (eq dll node)) (> n 0))
        (setq node (aref node branch))
-      (setq n (1- n)))
+      (cl-decf n))
      (unless (eq dll node) node)))

  (defun ewoc-location (node)
@@ -474,9 +474,9 @@ ewoc-goto-prev
      (when node
        ;; If we were past the last element, first jump to it.
        (when (>= (point) (ewoc--node-start-marker (ewoc--node-right node)))
-	(setq arg (1- arg)))
+	(cl-decf arg))
        (while (and node (> arg 0))
-	(setq arg (1- arg))
+	(cl-decf arg)
  	(setq node (ewoc--node-prev dll node)))
        ;; Never step above the first element.
        (unless (ewoc--filter-hf-nodes ewoc node)
@@ -489,7 +489,7 @@ ewoc-goto-next
    (ewoc--set-buffer-bind-dll-let* ewoc
        ((node (ewoc-locate ewoc (point))))
      (while (and node (> arg 0))
-      (setq arg (1- arg))
+      (cl-decf arg)
        (setq node (ewoc--node-next dll node)))
      ;; Never step below the first element.
      ;; (unless (ewoc--filter-hf-nodes ewoc node)
diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el
index a277d7a..0152370 100644
--- a/lisp/emacs-lisp/lisp-mode.el
+++ b/lisp/emacs-lisp/lisp-mode.el
@@ -43,19 +43,19 @@ lisp--mode-syntax-table
          (i 0))
      (while (< i ?0)
        (modify-syntax-entry i "_   " table)
-      (setq i (1+ i)))
+      (cl-incf i))
      (setq i (1+ ?9))
      (while (< i ?A)
        (modify-syntax-entry i "_   " table)
-      (setq i (1+ i)))
+      (cl-incf i))
      (setq i (1+ ?Z))
      (while (< i ?a)
        (modify-syntax-entry i "_   " table)
-      (setq i (1+ i)))
+      (cl-incf i))
      (setq i (1+ ?z))
      (while (< i 128)
        (modify-syntax-entry i "_   " table)
-      (setq i (1+ i)))
+      (cl-incf i))
      (modify-syntax-entry ?\s "    " table)
      ;; Non-break space acts as whitespace.
      (modify-syntax-entry ?\xa0 "    " table)
@@ -518,7 +518,7 @@ lisp-string-in-doc-position-p
             (condition-case nil
                 (while (and (> docelt 0) (< (point) startpos)
                             (progn (forward-sexp 1) t))
-                 (setq docelt (1- docelt)))
+                 (cl-decf docelt))
               (error nil))
             (and (zerop docelt) (<= (point) startpos)
                  (progn (forward-comment (point-max)) t)
@@ -994,7 +994,7 @@ lisp-indent-specform
      (while (and (< (point) indent-point)
                  (condition-case ()
                      (progn
-                      (setq count (1- count))
+                      (cl-decf count)
                        (forward-sexp 1)
                        (parse-partial-sexp (point) indent-point 1 t))
                    (error nil))))
diff --git a/lisp/emacs-lisp/map.el b/lisp/emacs-lisp/map.el
index 0a0f64a..35d4137 100644
--- a/lisp/emacs-lisp/map.el
+++ b/lisp/emacs-lisp/map.el
@@ -361,7 +361,7 @@ map--apply-array
      (seq-map (lambda (elt)
                 (prog1
                     (funcall function index elt)
-                 (setq index (1+ index))))
+                 (cl-incf index)))
               map)))

  (defun map--do-alist (function alist)
diff --git a/lisp/emacs-lisp/seq.el b/lisp/emacs-lisp/seq.el
index 2b4330c..04014fc 100644
--- a/lisp/emacs-lisp/seq.el
+++ b/lisp/emacs-lisp/seq.el
@@ -124,7 +124,7 @@ seq-do-indexed
    (let ((index 0))
      (seq-do (lambda (elt)
                 (funcall function elt index)
-               (setq index (1+ index)))
+               (cl-incf index))
               sequence)))

  (cl-defgeneric seqp (sequence)
@@ -162,7 +162,7 @@ seq-map-indexed
      (seq-map (lambda (elt)
                 (prog1
                     (funcall function elt index)
-                 (setq index (1+ index))))
+                 (cl-incf index)))
               sequence)))


@@ -361,7 +361,7 @@ seq-sort-by
        (seq-doseq (e sequence)
          (when (funcall (or testfn #'equal) e elt)
            (throw 'seq--break index))
-        (setq index (1+ index)))
+        (cl-incf index))
        nil)))

  (cl-defgeneric seq-uniq (sequence &optional testfn)
@@ -459,7 +459,7 @@ seq--make-pcase-bindings
                    (setq rest-marker t)))
            (_
             (push `(app (pcase--flip seq--elt-safe ,index) ,name) bindings))))
-      (setq index (1+ index)))
+      (cl-incf index))
      bindings))

  (defun seq--make-pcase-patterns (args)
@@ -495,7 +495,7 @@ seq--elt-safe
    "Optimized implementation of `seq-take' for lists."
    (let ((result '()))
      (while (and list (> n 0))
-      (setq n (1- n))
+      (cl-decf n)
        (push (pop list) result))
      (nreverse result)))

diff --git a/lisp/epg.el b/lisp/epg.el
index 315eb40..e240344 100644
--- a/lisp/epg.el
+++ b/lisp/epg.el
@@ -1323,7 +1323,7 @@ epg--list-keys-1
  			(string-match "\\([^:]+\\)?:" string index)))
  	  (setq index (match-end 0))
  	  (aset (car keys) field (match-string 1 string))
-	  (setq field (1+ field))))
+	  (cl-incf field)))
        (nreverse keys))))

  (defun epg--make-sub-key-1 (line)
diff --git a/lisp/erc/erc-track.el b/lisp/erc/erc-track.el
index a6d72d0..0777888 100644
--- a/lisp/erc/erc-track.el
+++ b/lisp/erc/erc-track.el
@@ -461,7 +461,7 @@ erc-unique-substrings
  	       (setq done t)
  	     (setq candidate (substring str 0 i)
  		   done (not (erc-unique-substring-1 candidate others))))
-	   (setq i (1+ i)))
+	   (cl-incf i))
  	 (if (and (= (length candidate) (1- maxlen))
  		  (not erc-track-shorten-aggressively))
  	     str
@@ -913,7 +913,7 @@ erc-track-face-priority
        (dolist (item erc-track-faces-priority-list)
  	(if (equal item face)
  	    (throw 'done t)
-	  (setq count (1+ count)))))
+	  (cl-incf count))))
      count))

  (defun erc-track-sort-by-importance ()
diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el
index 8501e2c..6c939a7 100644
--- a/lisp/erc/erc.el
+++ b/lisp/erc/erc.el
@@ -4801,7 +4801,7 @@ erc-parse-prefix
          (while (< i len)
            (setq alist (cons (cons (elt types i) (elt chars i))
                              alist))
-          (setq i (1+ i)))
+          (cl-incf i))
          alist))))

  (defun erc-channel-receive-names (names-string)
diff --git a/lisp/eshell/em-cmpl.el b/lisp/eshell/em-cmpl.el
index 4746767..e1a7c69 100644
--- a/lisp/eshell/em-cmpl.el
+++ b/lisp/eshell/em-cmpl.el
@@ -365,7 +365,7 @@ eshell-complete-parse-arguments
        (while (< pos end)
  	(if (get-text-property pos 'arg-begin)
  	    (nconc posns (list pos)))
-	(setq pos (1+ pos))))
+	(cl-incf pos)))
      (setq posns (cdr posns))
      (cl-assert (= (length args) (length posns)))
      (let ((a args)
diff --git a/lisp/eshell/em-hist.el b/lisp/eshell/em-hist.el
index 067c5ea..395117a 100644
--- a/lisp/eshell/em-hist.el
+++ b/lisp/eshell/em-hist.el
@@ -455,7 +455,7 @@ eshell-read-history
  		      (not (string-equal (ring-ref ring 0) history)))
  		  (ring-insert-at-beginning
  		   ring (subst-char-in-string ?\177 ?\n history))))
-	    (setq count (1+ count))))
+	    (cl-incf count)))
  	(setq eshell-history-ring ring
  	      eshell-history-index nil))))))

@@ -485,7 +485,7 @@ eshell-write-history
  	;; messier, than writing it one line at a time.
  	(with-temp-buffer
  	  (while (> index 0)
-	    (setq index (1- index))
+	    (cl-decf index)
  	    (let ((start (point)))
  	      (insert (ring-ref ring index) ?\n)
  	      (subst-char-in-region start (1- (point)) ?\n ?\177)))
@@ -515,7 +515,7 @@ eshell-list-history
  		    (and (>= (length hist) prelen)
  			 (string= (substring hist 0 prelen) prefix)))
  		(setq history (cons hist history))))
-	  (setq index (1- index)))
+	  (cl-decf index))
  	;; Change "completion" to "history reference"
  	;; to make the display accurate.
  	(with-output-to-temp-buffer history-buffer
@@ -622,7 +622,7 @@ eshell-complete-history-reference
  			    (string-match "^\\([^:^$*% \t\n]+\\)" hist))
  		       (setq history (cons (match-string 1 hist)
  					   history))))
-		 (setq index (1- index)))
+		 (cl-decf index))
  	       (let ((fhist (list t)))
  		 ;; uniquify the list, but preserve the order
  		 (while history
diff --git a/lisp/eshell/em-ls.el b/lisp/eshell/em-ls.el
index 8616dd2..1c2b5bc 100644
--- a/lisp/eshell/em-ls.el
+++ b/lisp/eshell/em-ls.el
@@ -783,7 +783,7 @@ eshell-ls-find-column-widths
  		 (> width best-width))
  	    (setq col-widths colw
  		  best-width width)))
-      (setq numcols (1- numcols)))
+      (cl-decf numcols))

      (cons (or col-widths (vector max-width)) files)))

@@ -834,7 +834,7 @@ eshell-ls-find-column-lengths
  	      (setq col-widths colw))
  	  (if (>= numcols (length widths))
  	      (setq numcols nil)
-	    (setq numcols (1+ numcols))))))
+	    (cl-incf numcols)))))

      (if (not col-widths)
  	(cons (vector max-width) files)
diff --git a/lisp/eshell/em-term.el b/lisp/eshell/em-term.el
index 208629c..8a834d4 100644
--- a/lisp/eshell/em-term.el
+++ b/lisp/eshell/em-term.el
@@ -317,7 +317,7 @@ eshell-term-sentinel
  ;	(while (< i 128)
  ;	  (define-key map (make-string 1 i) 'eshell-term-send-raw)
  ;	  (define-key esc-map (make-string 1 i) 'eshell-term-send-raw-meta)
-;	  (setq i (1+ i)))
+;	  (cl-incf i))
  ;	(define-key map "\e" esc-map)
  ;	(setq eshell-term-raw-map map)
  ;	(setq eshell-term-raw-escape-map
diff --git a/lisp/eshell/esh-io.el b/lisp/eshell/esh-io.el
index 1b4f409..563ef2f 100644
--- a/lisp/eshell/esh-io.el
+++ b/lisp/eshell/esh-io.el
@@ -252,7 +252,7 @@ eshell-protect-handles
        (if (aref handles idx)
  	  (setcdr (aref handles idx)
  		  (1+ (cdr (aref handles idx)))))
-      (setq idx (1+ idx))))
+      (cl-incf idx)))
    handles)

  (defun eshell-close-target (target status)
@@ -314,7 +314,7 @@ eshell-close-handles
  		  (eshell-close-target (car target) (= exit-code 0))
  		  (setq target (cdr target)))))
  	    (setcar (aref handles idx) nil))))
-      (setq idx (1+ idx)))
+      (cl-incf idx))
      nil))

  (defun eshell-kill-append (string)
diff --git a/lisp/eshell/esh-util.el b/lisp/eshell/esh-util.el
index 435e4ed..eb36f74 100644
--- a/lisp/eshell/esh-util.el
+++ b/lisp/eshell/esh-util.el
@@ -187,7 +187,7 @@ eshell-find-delimiter
  				      (char-before (1- (point)))
  				    (char-after (1+ (point)))) open))
  			 (forward-char (if reverse-p -1 1))
-		       (setq depth (1- depth)))))
+		       (cl-decf depth))))
  		((= c open)
  		 (setq depth (+ depth (if reverse-p -1 1))))
  		((= c close)
@@ -258,7 +258,7 @@ eshell-split-path
  	  (setq parts (cons (if (= li i) "/"
  			      (substring path li (1+ i))) parts)
  		li (1+ i)))
-      (setq i (1+ i)))
+      (cl-incf i))
      (if (< li i)
  	(setq parts (cons (substring path li i) parts)))
      (if (and (eshell-under-windows-p)
@@ -518,7 +518,7 @@ eshell-read-host-names
         (let ((i (length string))
  	     (newstr (if inplace string (copy-sequence string))))
  	 (while (> i 0)
-	   (setq i (1- i))
+	   (cl-decf i)
  	   (if (eq (aref newstr i) fromchar)
  	       (aset newstr i tochar)))
  	 newstr)))
diff --git a/lisp/font-lock.el b/lisp/font-lock.el
index b5ff5cf..11cd19a 100644
--- a/lisp/font-lock.el
+++ b/lisp/font-lock.el
@@ -1292,7 +1292,7 @@ font-lock-after-change-function
  	    ;; line right after `end'.  Typical case: the first char of
  	    ;; the line was deleted.  Or a \n was inserted in the middle
  	    ;; of a line.
-	    (setq end (1+ end))))
+	    (cl-incf end)))
  	(font-lock-fontify-region beg end)))))

  (defvar jit-lock-start) (defvar jit-lock-end)
diff --git a/lisp/frame.el b/lisp/frame.el
index a584567..a25a8d7 100644
--- a/lisp/frame.el
+++ b/lisp/frame.el
@@ -121,7 +121,7 @@ handle-delete-frame
      (while tail
        (and (frame-visible-p (car tail))
  	   (not (eq (car tail) frame))
-	  (setq i (1+ i)))
+	  (cl-incf i))
        (setq tail (cdr tail)))
      (if (> i 0)
  	(delete-frame frame t)
@@ -838,12 +838,12 @@ other-frame
        (setq frame (next-frame frame))
        (while (not (eq (frame-visible-p frame) t))
  	(setq frame (next-frame frame)))
-      (setq arg (1- arg)))
+      (cl-decf arg))
      (while (< arg 0)
        (setq frame (previous-frame frame))
        (while (not (eq (frame-visible-p frame) t))
  	(setq frame (previous-frame frame)))
-      (setq arg (1+ arg)))
+      (cl-incf arg))
      (select-frame-set-input-focus frame)))

  (defun iconify-or-deiconify-frame ()
@@ -2100,7 +2100,7 @@ blink-cursor-timer-function
    ;; since otherwise menu tooltips will behave erratically.
    (or (and (fboundp 'w32--menu-bar-in-use)
  	   (w32--menu-bar-in-use))
-      (setq blink-cursor-blinks-done (1+ blink-cursor-blinks-done)))
+      (cl-incf blink-cursor-blinks-done))
    ;; Each blink is two calls to this function.
    (when (and (> blink-cursor-blinks 0)
               (<= (* 2 blink-cursor-blinks) blink-cursor-blinks-done))
diff --git a/lisp/help-fns.el b/lisp/help-fns.el
index 87e7d8f..c26d133 100644
--- a/lisp/help-fns.el
+++ b/lisp/help-fns.el
@@ -1182,7 +1182,7 @@ describe-categories
          (insert "\n")
  	(let ((pos (point)) (items 0) lines n)
  	  (dotimes (i 95)
-	    (if (aref docs i) (setq items (1+ items))))
+	    (if (aref docs i) (cl-incf items)))
  	  (setq lines (1+ (/ (1- items) 4)))
  	  (setq n 0)
  	  (dotimes (i 95)
@@ -1198,7 +1198,7 @@ describe-categories
  		(if (< (point) (point-max))
  		    (forward-line 1)
  		  (insert "\n"))
-		(setq n (1+ n))
+		(cl-incf n)
  		(if (= (% n lines) 0)
  		    (goto-char pos))))))
  	(goto-char (point-max))
diff --git a/lisp/hexl.el b/lisp/hexl.el
index 5f099a5..53320e3 100644
--- a/lisp/hexl.el
+++ b/lisp/hexl.el
@@ -350,7 +350,7 @@ hexl-mode
  	  (inhibit-read-only t)
  	  (original-point (- (point) (point-min))))
        (and (eobp) (not (bobp))
-	   (setq original-point (1- original-point)))
+	   (cl-decf original-point))
        ;; If `hexl-mode' is invoked with an argument the buffer is assumed to
        ;; be in hexl format.
        (when (memq arg '(1 nil))
@@ -361,7 +361,7 @@ hexl-mode
  	(when (eq (coding-system-eol-type buffer-file-coding-system) 1)
            (setq original-point (+ (count-lines (point-min) (point))
  				  original-point))
-	  (or (bolp) (setq original-point (1- original-point))))
+	  (or (bolp) (cl-decf original-point)))
          (hexlify-buffer)
          (restore-buffer-modified-p modified))
        (set (make-local-variable 'hexl-max-address)
@@ -501,7 +501,7 @@ hexl-mode-exit
  	(when (eq (coding-system-eol-type buffer-file-coding-system) 1)
  	  (setq original-point (- original-point
  				  (count-lines (point-min) (point))))
-	  (or (bobp) (setq original-point (1+ original-point))))
+	  (or (bobp) (cl-incf original-point)))
  	(goto-char original-point)))

    (remove-hook 'change-major-mode-hook 'hexl-maybe-dehexlify-buffer t)
@@ -641,7 +641,7 @@ hexl-backward-short
                                         (if (equal address (logior address 3))
                                             (+ address 4)
                                           (logior address 3))))
-			       (setq arg (1- arg)))
+			       (cl-decf arg))
                               (setq address
                                     (if (> address hexl-max-address)
                                         (progn
@@ -654,7 +654,7 @@ hexl-backward-short
  			     (if (not (equal address 0))
  				 (setq address (- address 4))
  			       (message "Beginning of buffer.")))
-			   (setq arg (1- arg))))
+			   (cl-decf arg)))
  		       address)))

  (defun hexl-forward-short (arg)
@@ -678,7 +678,7 @@ hexl-backward-word
                                         (if (equal address (logior address 7))
                                             (+ address 8)
                                           (logior address 7))))
-			       (setq arg (1- arg)))
+			       (cl-decf arg))
                               (setq address
                                     (if (> address hexl-max-address)
                                         (progn
@@ -691,7 +691,7 @@ hexl-backward-word
  			     (if (not (equal address 0))
  				 (setq address (- address 8))
  			       (message "Beginning of buffer.")))
-			   (setq arg (1- arg))))
+			   (cl-decf arg)))
  		       address)))

  (defun hexl-forward-word (arg)
@@ -946,7 +946,7 @@ hexl-insert-multibyte-char
  	     (while (> num 0)
  	       (mapc
  		(function (lambda (c) (hexl-insert-char c 1))) encoded)
-	       (setq num (1- num))))))))
+	       (cl-decf num)))))))

  (defun hexl-self-insert-command (arg)
    "Insert this character.
@@ -981,14 +981,14 @@ hexl-insert-char
  	(delete-char 1)
  	(insert (hexl-printable-character ch))
  	(or (eq address hexl-max-address)
-	    (setq address (1+ address)))
+	    (cl-incf address))
  	(hexl-goto-address address)
  	(if at-ascii-position
  	    (progn
  	      (beginning-of-line)
  	      (forward-char (hexl-ascii-start-column))
  	      (forward-char (% address 16)))))
-      (setq num (1- num)))))
+      (cl-decf num))))

  ;; hex conversion

diff --git a/lisp/ibuffer.el b/lisp/ibuffer.el
index 9becfc9..25d41a63 100644
--- a/lisp/ibuffer.el
+++ b/lisp/ibuffer.el
@@ -1456,11 +1456,11 @@ ibuffer-mark-interactive
      (while (> arg 0)
        (ibuffer-set-mark mark)
        (ibuffer-forward-line 1 t)
-      (setq arg (1- arg)))
+      (cl-decf arg))
      (while (< arg 0)
        (ibuffer-forward-line -1 t)
        (ibuffer-set-mark mark)
-      (setq arg (1+ arg)))))
+      (cl-incf arg))))

  (defun ibuffer-set-mark (mark)
    (ibuffer-assert-ibuffer-mode)
@@ -1875,10 +1875,10 @@ filename-and-process
  	   (files 0))
         (dolist (string strings)
  	 (if (string-match "\\(?:\\`([[:ascii:]]+)\\)" string)
-	     (progn (setq procs (1+ procs))
+	     (progn (cl-incf procs)
  		    (if (< (match-end 0) (length string))
-			(setq files (1+ files))))
-	   (setq files (1+ files))))
+			(cl-incf files)))
+	   (cl-incf files)))
         (concat (cond ((zerop files) "No files")
  		     ((= 1 files) "1 file")
  		     (t (format "%d files" files)))
diff --git a/lisp/image-dired.el b/lisp/image-dired.el
index a55dd40..ee04bc6 100644
--- a/lisp/image-dired.el
+++ b/lisp/image-dired.el
@@ -1642,7 +1642,7 @@ image-dired-slideshow-step
    (if (< image-dired-slideshow-count image-dired-slideshow-times)
        (progn
          (message "%s" (1+ image-dired-slideshow-count))
-        (setq image-dired-slideshow-count (1+ image-dired-slideshow-count))
+        (cl-incf image-dired-slideshow-count)
          (image-dired-next-line-and-display))
      (image-dired-slideshow-stop)))

@@ -1706,7 +1706,7 @@ image-dired-line-up
          (if (= image-dired-thumbs-per-row 1)
              (insert "\n")
            (insert " ")
-          (setq count (1+ count))
+          (cl-incf count)
            (when (and (= count (- image-dired-thumbs-per-row 1))
  		     (not (eobp)))
              (forward-char)
@@ -2410,7 +2410,7 @@ image-dired-gallery-generate
  	      (setq tag-link-list
  		    (append tag-link-list (list (cons tag tag-link))))
  	    (setq tag-link-list (list (cons tag tag-link))))
-	  (setq count (1+ count))))
+	  (cl-incf count)))
        (setq count 1)
        ;; Main loop where we generated thumbnail pages per tag
        (dolist (curr tags)
@@ -2457,7 +2457,7 @@ image-dired-gallery-generate
  	    (insert "  <p><a href=\"index.html\">Index</a></p>\n")
  	    (insert "  </body>\n")
  	    (insert "</html>\n"))
-	  (setq count (1+ count))))
+	  (cl-incf count)))
        (insert "  </body>\n")
        (insert "</html>"))))

diff --git a/lisp/image-mode.el b/lisp/image-mode.el
index f526685..0877a72 100644
--- a/lisp/image-mode.el
+++ b/lisp/image-mode.el
@@ -924,7 +924,7 @@ image-next-file
        (dolist (f images)
  	(if (string= f file)
  	    (throw 'image-visit-next-file (1+ idx)))
-	(setq idx (1+ idx))))
+	(cl-incf idx)))
      (setq idx (mod (+ idx (or n 1)) (length images)))
      (find-alternate-file (nth idx images))))

diff --git a/lisp/info.el b/lisp/info.el
index c8b8002..581508a 100644
--- a/lisp/info.el
+++ b/lisp/info.el
@@ -2552,7 +2552,7 @@ Info-follow-reference
  	 (while (setq i (string-match "[ \n\t]+" str i))
  	   (setq str (concat (substring str 0 i) " "
  			     (substring str (match-end 0))))
-	   (setq i (1+ i)))
+	   (cl-incf i))
  	 ;; Record as a completion and perhaps as default.
  	 (if (eq default t) (setq default str))
  	 (if (eq alt-default t) (setq alt-default str))
@@ -3129,7 +3129,7 @@ Info-next-reference
      (setq count 1))
    (if (< count 0)
        (Info-prev-reference recur (- count))
-    (while (unless (zerop count) (setq count (1- count)))
+    (while (unless (zerop count) (cl-decf count))
        (let ((pat "\\*note[ \n\t]+\\([^:]+\\):\\|^\\* .*:\\|[hf]t?tps?://")
  	    (old-pt (point))
  	    (case-fold-search t))
@@ -3157,7 +3157,7 @@ Info-prev-reference
      (setq count 1))
    (if (< count 0)
        (Info-next-reference recur (- count))
-    (while (unless (zerop count) (setq count (1- count)))
+    (while (unless (zerop count) (cl-decf count))
        (let ((pat "\\*note[ \n\t]+\\([^:]+\\):\\|^\\* .*:\\|[hf]t?tps?://")
  	    (old-pt (point))
  	    (case-fold-search t))
@@ -4167,7 +4167,7 @@ Info-menu-update
  	      (while (setq i (string-match "[ \n\t]+" str i))
  		(setq str (concat (substring str 0 i) " "
  				  (substring str (match-end 0))))
-		(setq i (1+ i)))
+		(cl-incf i))
  	      (setq items
  		    (cons str items))))
  	  (while (and items (< number 9))
@@ -4571,7 +4571,7 @@ Info-breadcrumbs
      (while (and (not (equal "Top" node)) (> depth 0))
        (setq node (nth 1 (assoc node nodes)))
        (if node (push node crumbs))
-      (setq depth (1- depth)))
+      (cl-decf depth))

      ;; Add bottom node.
      (when Info-use-header-line
@@ -4899,7 +4899,7 @@ Info-fontify-node
                    nil t)
  	    (when (match-beginning 1)
  	      (when not-fontified-p
-		(setq n (1+ n))
+		(cl-incf n)
  		(if (and (<= n 9) (zerop (% n 3))) ; visual aids to help with 1-9 keys
  		    (put-text-property (match-beginning 0)
  				       (1+ (match-beginning 0))
@@ -5008,7 +5008,7 @@ Info-fontify-node
                (fncount 0))
            ;; How many footnotes do we have in this node?
            (while (re-search-forward "^ [ \t]*([0-9]+) " nil t)
-            (setq fncount (1+ fncount)))
+            (cl-incf fncount))
            (goto-char (point-min))
            (while (re-search-forward "\\((\\([0-9]+\\))\\)" nil t)
              (let ((footnote-num (string-to-number (match-string 2))))
diff --git a/lisp/international/mule-cmds.el b/lisp/international/mule-cmds.el
index 28eec4f..fd5c9f4 100644
--- a/lisp/international/mule-cmds.el
+++ b/lisp/international/mule-cmds.el
@@ -586,7 +586,7 @@ find-multibyte-characters
  			      (if (or (not maxcount) (< count maxcount))
  				  (nconc slot (list char)))))
  		      (setq chars (cons (list charset 1 char) chars)))))
-		(setq idx (1+ idx)))))
+		(cl-incf idx))))
        (if enable-multibyte-characters
  	  (save-excursion
  	    (goto-char from)
@@ -783,7 +783,7 @@ select-safe-coding-system-interactively
  			 'help-function func2
  			 'help-args (list bufname (car elt)
  					  (car coding)))))
-		    (setq i (1+ i))))
+		    (cl-incf i)))
  		(insert "\n"))
  	      (insert (substitute-command-keys "\

@@ -2964,7 +2964,7 @@ ucs-names
  		;; higher code, so it gets pushed later!
  		(if new-name (push (cons new-name c) names))
  		(if old-name (push (cons old-name c) names))
-		(setq c (1+ c))))))
+		(cl-incf c)))))
  	;; Special case for "BELL" which is apparently the only char which
  	;; doesn't have a new name and whose old-name is shadowed by a newer
  	;; char with that name.
diff --git a/lisp/international/quail.el b/lisp/international/quail.el
index 320d783..91e0763 100644
--- a/lisp/international/quail.el
+++ b/lisp/international/quail.el
@@ -275,14 +275,14 @@ quail-translation-keymap
  	(i 0))
      (while (< i ?\ )
        (define-key map (char-to-string i) 'quail-other-command)
-      (setq i (1+ i)))
+      (cl-incf i))
      (while (< i 127)
        (define-key map (char-to-string i) 'quail-self-insert-command)
-      (setq i (1+ i)))
+      (cl-incf i))
      (setq i 128)
      (while (< i 256)
        (define-key map (vector i) 'quail-self-insert-command)
-      (setq i (1+ i)))
+      (cl-incf i))
      (define-key map "\177" 'quail-delete-last-char)
      (define-key map "\C-f" 'quail-next-translation)
      (define-key map "\C-b" 'quail-prev-translation)
@@ -346,14 +346,14 @@ quail-simple-translation-keymap
  	(i 0))
      (while (< i ?\ )
        (define-key map (char-to-string i) 'quail-other-command)
-      (setq i (1+ i)))
+      (cl-incf i))
      (while (< i 127)
        (define-key map (char-to-string i) 'quail-self-insert-command)
-      (setq i (1+ i)))
+      (cl-incf i))
      (setq i 128)
      (while (< i 256)
        (define-key map (vector i) 'quail-self-insert-command)
-      (setq i (1+ i)))
+      (cl-incf i))
      (define-key map "\177" 'quail-delete-last-char)
      (define-key map [delete] 'quail-delete-last-char)
      (define-key map [backspace] 'quail-delete-last-char)
@@ -370,11 +370,11 @@ quail-conversion-keymap
  	(i ?\ ))
      (while (< i 127)
        (define-key map (char-to-string i) 'quail-self-insert-command)
-      (setq i (1+ i)))
+      (cl-incf i))
      (setq i 128)
      (while (< i 256)
        (define-key map (vector i) 'quail-self-insert-command)
-      (setq i (1+ i)))
+      (cl-incf i))
      (define-key map "\C-b" 'quail-conversion-backward-char)
      (define-key map "\C-f" 'quail-conversion-forward-char)
      (define-key map "\C-a" 'quail-conversion-beginning-of-region)
@@ -717,7 +717,7 @@ quail-update-keyboard-layout
        ;; Sum up additional key locations not in the standard layout in
        ;; subst-list, and missing key locations in missing-list.
        (while (> i 0)
-	(setq i (1- i))
+	(cl-decf i)
  	(if (= (aref quail-keyboard-layout i) ? )
  	    (if (/= (aref quail-keyboard-layout-standard i) ? )
  		(setq missing-list (cons i missing-list)))
@@ -770,7 +770,7 @@ quail-keyboard-translate
        ;; Find the key location on the current keyboard layout.
        (while (and (< i quail-keyboard-layout-len)
  		  (/= char (aref quail-keyboard-layout i)))
-	(setq i (1+ i)))
+	(cl-incf i))
        (if (= i quail-keyboard-layout-len)
  	  ;; CHAR is not in quail-keyboard-layout, which means that a
  	  ;; user typed a key which generated a character code to be
@@ -819,7 +819,7 @@ quail-insert-kbd-layout
  	      (setq done-list (cons translation done-list)))
  	  (setq translation (aref kbd-layout i)))
  	(aset layout i translation))
-      (setq i (1+ i)))
+      (cl-incf i))

      (let ((pos (point))
  	  (bar "|")
@@ -1156,7 +1156,7 @@ quail-defrule-internal
  	    (setq entry (cons ch (list nil)))
  	    (setcdr map (cons entry (cdr map)))))
        (setq map (cdr entry))
-      (setq idx (1+ idx)))
+      (cl-incf idx))
      (if (symbolp trans)
  	(if (cdr map)
  	    ;; We come here, for example, when we try to define a rule
@@ -1190,7 +1190,7 @@ quail-defrule-internal
  	  (let ((len (length trans))
  		elt)
  	    (while (> len 0)
-	      (setq len (1- len))
+	      (cl-decf len)
  	      (setq elt (aref trans len))
  	      (if (integerp elt)
  		  (setq elt (char-to-string elt)))
@@ -1271,7 +1271,7 @@ quail-lookup-key
      (while (and map (< idx len))
        (setq ch (if kbd-translate (quail-keyboard-translate (aref key idx))
  		 (aref key idx)))
-      (setq idx (1+ idx))
+      (cl-incf idx)
        (if (and (cdr map) (symbolp (cdr map)))
  	  (setcdr map (funcall (cdr map) key idx)))
        (setq slot (assq ch (cdr map)))
@@ -1547,7 +1547,7 @@ quail-update-translation
  			   quail-current-key)))
  	       (or input-method-exit-on-first-char
  		   (while (> len control-flag)
-		     (setq len (1- len))
+		     (cl-decf len)
  		     (setq unread-command-events
  			   (cons (aref quail-current-key len)
  				 unread-command-events))))))
@@ -1690,7 +1690,7 @@ quail-update-current-translations
  	    (if (and (> num-items 0)
  		     (or (>= col maxcol) (> num-items 10)))
  		(setq end idx num-items 0)
-	      (setq idx (1+ idx))))
+	      (cl-incf idx)))
  	  (setcar (nthcdr 3 indices) block)
  	  (if (>= idx len)
  	      (progn
@@ -1769,7 +1769,7 @@ quail-translate-key
  	     ;; handle the remaining characters in a new loop.
  	     (setq def nil)
  	     (while (and (not def) (> len 1))
-	       (setq len (1- len))
+	       (cl-decf len)
  	       (setq def (quail-map-definition
  			  (quail-lookup-key quail-current-key len))))
  	     (if def (setq quail-current-str
@@ -2172,7 +2172,7 @@ quail-get-translations
  		(if (= idx cur)
  		    (put-text-property (+ len 3) (length str)
  				      'face 'highlight str))
-		(setq idx (1+ idx))))))
+		(cl-incf idx)))))

        str))

@@ -2265,7 +2265,7 @@ quail-completion-list-translations
  	  (insert (aref translations i))
  	  ;;  Passing the mouse over a character will highlight.
  	  (put-text-property beg (point) 'mouse-face 'highlight)
-	  (setq i (1+ i)))
+	  (cl-incf i))
  	(insert "\n")))))

  (defun quail-mouse-choose-completion (event)
@@ -2335,7 +2335,7 @@ quail-build-decode-map
  	   (when (and (> translation 127) (not (memq translation ignores)))
  	     (setcdr decode-map
  		     (cons (cons key translation) (cdr decode-map)))
-	     (setq num (1+ num))))
+	     (cl-incf num)))
  	  ((consp translation)
  	   (setq translation (cdr translation))
  	   (let ((multibyte nil))
diff --git a/lisp/isearch.el b/lisp/isearch.el
index 9418064..4143c3f 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -438,7 +438,7 @@ isearch-mode-map
      (setq i ?\s)
      (while (< i 256)
        (define-key map (vector i) 'isearch-printing-char)
-      (setq i (1+ i)))
+      (cl-incf i))

      ;; To handle local bindings with meta char prefix keys, define
      ;; another full keymap.  This must be done for any other prefix
@@ -3015,7 +3015,7 @@ isearch-no-upper-case-p
  	  (if (and (not quote-flag) (not (eq char (downcase char))))
  	      (setq found t))
  	  (setq quote-flag nil)))
-      (setq i (1+ i)))
+      (cl-incf i))
      (not (or found
               ;; Even if there's no uppercase char, we want to detect the use
               ;; of [:upper:] or [:lower:] char-class, which indicates
@@ -3260,7 +3260,7 @@ isearch-lazy-highlight-update
  	    (while looping
  	      (let ((found (isearch-lazy-highlight-search)))
  		(when max
-		  (setq max (1- max))
+		  (cl-decf max)
  		  (if (<= max 0)
  		      (setq looping nil)))
  		(if found
diff --git a/lisp/leim/quail/latin-ltx.el b/lisp/leim/quail/latin-ltx.el
index fb3d2ba..bea699b 100644
--- a/lisp/leim/quail/latin-ltx.el
+++ b/lisp/leim/quail/latin-ltx.el
@@ -85,9 +85,9 @@
                                   (funcall seq name char))))
                       (if (listp keys)
                           (dolist (x keys)
-                           (setq count (1+ count))
+                           (cl-incf count)
                             (push (list x char) newrules))
-                       (setq count (1+ count))
+                       (cl-incf count)
                         (push (list keys char) newrules))))))
               ;; (message "latin-ltx: %d mappings for %S" count re)
  	     ))))
diff --git a/lisp/mail/footnote.el b/lisp/mail/footnote.el
index a90f370..7205fc2 100644
--- a/lisp/mail/footnote.el
+++ b/lisp/mail/footnote.el
@@ -174,7 +174,7 @@ Footnote-english-upper
  	 rc)
      (while (>= rep 0)
        (setq rc (concat rc chr))
-      (setq rep (1- rep)))
+      (cl-decf rep))
      rc))

  ;;; ENGLISH LOWER
@@ -193,7 +193,7 @@ Footnote-english-lower
  	 rc)
      (while (>= rep 0)
        (setq rc (concat rc chr))
-      (setq rep (1- rep)))
+      (cl-decf rep))
      rc))

  ;;; ROMAN LOWER
@@ -235,7 +235,7 @@ Footnote-roman-common
      (while (and (<= count-high (1- rom-lngth))
  		(>= n (car (nth count-high our-list))))
        ;; (message "Checking %d" (car (nth count-high our-list)))
-      (setq count-high (1+ count-high)))
+      (cl-incf count-high))
      (setq rom-high count-high)
      (setq rom-low (1- count-high))
      ;; find the appropriate divisor (if it exists)
@@ -248,7 +248,7 @@ Footnote-roman-common
  			(car (nth count-low our-list)))))
  	(setq rom-div count-low))
        ;; (message "Checking %d and %d in div loop" rom-high count-low)
-      (setq count-low (1+ count-low)))
+      (cl-incf count-low))
      ;;(message "We now have high: %d, low: %d, div: %d, n: %d"
      ;;	       rom-high rom-low (if rom-div rom-div -1) n)
      (let ((rom-low-pair (nth rom-low our-list))
@@ -394,7 +394,7 @@ Footnote-refresh-footnotes
  	      'footnote-number (1+ i) footnote-mouse-highlight t)
  	     nil "\\1"))
  	  (setq locn (cdr locn)))
-	(setq i (1+ i))))
+	(cl-incf i)))

      ;; Now take care of the text section
      (let ((i 0) alist)
@@ -412,7 +412,7 @@ Footnote-refresh-footnotes
  	     footnote-end-tag)
  	    'footnote-number (1+ i))
  	   nil "\\1"))
-	(setq i (1+ i))))))
+	(cl-incf i)))))

  (defun Footnote-assoc-index (key alist)
    "Give index of key in alist."
@@ -421,7 +421,7 @@ Footnote-assoc-index
  		(< i max))
        (when (eq key (car (nth i alist)))
  	(setq rc i))
-      (setq i (1+ i)))
+      (cl-incf i))
      rc))

  (defun Footnote-cycle-style ()
@@ -597,7 +597,7 @@ Footnote-text-under-cursor
  		  (null rc))
  	(when (< (point) (cdr alist-txt))
  	  (setq rc (car (nth (1- i) footnote-text-marker-alist))))
-	(setq i (1+ i)))
+	(cl-incf i))
        (when (and (null rc)
  		 (null alist-txt))
  	(setq rc (car (nth (1- i) footnote-text-marker-alist))))
@@ -631,7 +631,7 @@ Footnote-make-hole
  			       (1+ (car alist-ptr))
  			       alist-ptr
  			       alist-txt)))
-	(setq i (1+ i)))
+	(cl-incf i))
        rc)))

  (defun Footnote-add-footnote (&optional arg)
@@ -733,7 +733,7 @@ Footnote-renumber-footnotes
  	(setq alist-txt (nth i footnote-text-marker-alist))
  	(unless (= (1+ i) (car alist-ptr))
  	  (Footnote-renumber (car alist-ptr) (1+ i) alist-ptr alist-txt))
-	(setq i (1+ i))))))
+	(cl-incf i)))))

  (defun Footnote-goto-footnote (&optional arg)
    "Jump to the text of a footnote.
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index 175189c..6e1a602 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -955,7 +955,7 @@ completion--replace
                  (< (+ beg prefix-len) end)
                  (eq (char-after (+ beg prefix-len))
                      (aref newtext prefix-len)))
-      (setq prefix-len (1+ prefix-len)))
+      (cl-incf prefix-len))
      (unless (zerop prefix-len)
        (setq beg (+ beg prefix-len))
        (setq newtext (substring newtext prefix-len))))
@@ -965,7 +965,7 @@ completion--replace
                  (< beg (- end suffix-len))
                  (eq (char-before (- end suffix-len))
                      (aref newtext (- (length newtext) suffix-len 1))))
-      (setq suffix-len (1+ suffix-len)))
+      (cl-incf suffix-len))
      (unless (zerop suffix-len)
        (setq end (- end suffix-len))
        (setq newtext (substring newtext 0 (- suffix-len))))
@@ -1605,7 +1605,7 @@ completion--insert-strings
  	      (if (> column 0)
  		  (forward-line)
  		(insert "\n"))
-	      (setq row (1+ row)))
+	      (cl-incf row))
  	     (t
  	      ;; Horizontal format
  	      ;; Next column to align to.
@@ -2419,7 +2419,7 @@ completion--sifn-requote
                    (string-prefix-p uprefix
                                     (substitute-in-file-name
                                      (substring qstr 0 (1- qpos)))))
-        (setq qpos (1- qpos)))
+        (cl-decf qpos))
        (cons qpos #'minibuffer--double-dollars))))

  (defalias 'completion--file-name-table
@@ -3162,7 +3162,7 @@ completion-pcm--merge-completions
              (while (setq next (match-end i))
                (push (substring str last next) chopped)
                (setq last next)
-              (setq i (1+ i)))
+              (cl-incf i))
              ;; Add the text corresponding to the implicit trailing `any'.
              (push (substring str last) chopped)
              (push (nreverse chopped) ccs))))
diff --git a/lisp/net/dbus.el b/lisp/net/dbus.el
index 2d7cd2f..befbb95 100644
--- a/lisp/net/dbus.el
+++ b/lisp/net/dbus.el
@@ -690,7 +690,7 @@ dbus-register-signal
  	  (if (stringp arg)
  	      (setq rule (concat rule (format ",arg%d='%s'" counter arg)))
  	    (if arg (signal 'wrong-type-argument (list "Wrong argument" arg))))
-	  (setq counter (1+ counter)))
+	  (cl-incf counter))

        ;; Parse keywords.
        (while args
diff --git a/lisp/net/eudc.el b/lisp/net/eudc.el
index 22e48db..a9ec241 100644
--- a/lisp/net/eudc.el
+++ b/lisp/net/eudc.el
@@ -793,7 +793,7 @@ eudc-extract-n-word-formats
  				 format
  			       nil))
  			  format-list)))
-      (setq n (1- n)))
+      (cl-decf n))
      formats))


diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index 7672bf0..647c38a 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -1538,7 +1538,7 @@ eww-make-unique-file-name
              suffix (match-string 2)))
      (while (file-exists-p (expand-file-name file directory))
        (setq file (format "%s(%d)%s" stem count suffix))
-      (setq count (1+ count)))
+      (cl-incf count))
      (expand-file-name file directory)))

  (defun eww-set-character-encoding (charset)
diff --git a/lisp/net/mailcap.el b/lisp/net/mailcap.el
index f71d7ba..04f567d 100644
--- a/lisp/net/mailcap.el
+++ b/lisp/net/mailcap.el
@@ -540,7 +540,7 @@ mailcap-parse-mailcap-extras
  	  (setq val-pos (point))
  	  (if (memq (char-after val-pos) '(?\" ?'))
  	      (progn
-		(setq val-pos (1+ val-pos))
+		(cl-incf val-pos)
  		(condition-case nil
  		    (progn
  		      (forward-sexp 1)
diff --git a/lisp/net/pinentry.el b/lisp/net/pinentry.el
index 082a9c8..30bdabb 100644
--- a/lisp/net/pinentry.el
+++ b/lisp/net/pinentry.el
@@ -225,8 +225,8 @@ pinentry--escape-string
          (count 0))
      (while (< index length)
        (if (memq (aref string index) '(?\n ?\r ?%))
-          (setq count (1+ count)))
-      (setq index (1+ index)))
+          (cl-incf count))
+      (cl-incf index))
      (setq index 0)
      (let ((result (make-string (+ length (* count 2)) ?\0))
            (result-index 0)
@@ -236,14 +236,14 @@ pinentry--escape-string
          (if (memq c '(?\n ?\r ?%))
              (let ((hex (format "%02X" c)))
                (aset result result-index ?%)
-              (setq result-index (1+ result-index))
+              (cl-incf result-index)
                (aset result result-index (aref hex 0))
-              (setq result-index (1+ result-index))
+              (cl-incf result-index)
                (aset result result-index (aref hex 1))
-              (setq result-index (1+ result-index)))
+              (cl-incf result-index))
            (aset result result-index c)
-          (setq result-index (1+ result-index)))
-        (setq index (1+ index)))
+          (cl-incf result-index))
+        (cl-incf index))
        result)))

  (defun pinentry--unescape-string (string)
@@ -262,11 +262,11 @@ pinentry--unescape-string
  						 (1+ index)
  						 (+ index 3))
  				      16))
-	      (setq result-index (1+ result-index))
+	      (cl-incf result-index)
  	      (setq index (+ index 2)))
            (aset result result-index c)
-          (setq result-index (1+ result-index)))
-	(setq index (1+ index)))
+          (cl-incf result-index))
+	(cl-incf index))
        (substring result 0 result-index))))

  (defun pinentry--send-data (process escaped)
diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el
index d64de0f..9943041 100644
--- a/lisp/net/rcirc.el
+++ b/lisp/net/rcirc.el
@@ -883,13 +883,13 @@ rcirc-insert-prev-input
    (when (<= rcirc-prompt-end-marker (point))
      (delete-region rcirc-prompt-end-marker (point-max))
      (insert (rcirc-prev-input-string 0))
-    (setq rcirc-input-ring-index (1+ rcirc-input-ring-index))))
+    (cl-incf rcirc-input-ring-index)))

  (defun rcirc-insert-next-input ()
    (interactive)
    (when (<= rcirc-prompt-end-marker (point))
      (delete-region rcirc-prompt-end-marker (point-max))
-    (setq rcirc-input-ring-index (1- rcirc-input-ring-index))
+    (cl-decf rcirc-input-ring-index)
      (insert (rcirc-prev-input-string -1))))

  (defvar rcirc-server-commands
@@ -1609,7 +1609,7 @@ rcirc-print
  		    (put-text-property (1- start) (1- rcirc-prompt-start-marker)
  				       'invisible 'rcirc-omit)
  		  ;; otherwise increment the line count
-		  (setq rcirc-current-line (1+ rcirc-current-line))))))
+		  (cl-incf rcirc-current-line)))))

  	  (set-marker-insertion-type rcirc-prompt-start-marker nil)
  	  (set-marker-insertion-type rcirc-prompt-end-marker nil)
diff --git a/lisp/nxml/nxml-mode.el b/lisp/nxml/nxml-mode.el
index 0b9975f..00ac1a9 100644
--- a/lisp/nxml/nxml-mode.el
+++ b/lisp/nxml/nxml-mode.el
@@ -1526,11 +1526,11 @@ nxml-forward-balanced-item
    (cond ((> arg 0)
  	 (while (progn
  		  (nxml-forward-single-balanced-item)
-		  (> (setq arg (1- arg)) 0))))
+		  (> (cl-decf arg) 0))))
  	((< arg 0)
  	 (while (progn
  		  (nxml-backward-single-balanced-item)
-		  (< (setq arg (1+ arg)) 0))))))
+		  (< (cl-incf arg) 0))))))

  (defun nxml-forward-single-balanced-item ()
    (condition-case err
@@ -1755,7 +1755,7 @@ nxml-up-element
  				 token-end)
  			       t))
  			     (t (error "No parent element")))))
-	  (setq arg (1- arg)))
+	  (cl-decf arg))
        (nxml-scan-error
         (goto-char (cadr err))
         (apply #'error (cddr err))))))
@@ -1784,7 +1784,7 @@ nxml-backward-up-element
  			       t)
  			      xmltok-start)
  			     (t (error "No parent element")))))
-	  (setq arg (1- arg)))
+	  (cl-decf arg))
        (nxml-scan-error
         (goto-char (cadr err))
         (apply #'error (cddr err))))))
@@ -1808,7 +1808,7 @@ nxml-down-element
  		    (not (memq xmltok-type '(start-tag partial-start-tag))))
  	     (nxml-tokenize-forward))
  	   (point))))
-      (setq arg (1- arg)))))
+      (cl-decf arg))))

  (defun nxml-backward-down-element (&optional arg)
    (interactive "^p")
@@ -1833,7 +1833,7 @@ nxml-backward-down-element
  	       (nxml-move-outside-backwards)
  	       (xmltok-forward)))
  	   xmltok-start))
-      (setq arg (1- arg)))))
+      (cl-decf arg))))

  (defun nxml-forward-element (&optional arg)
    "Move forward over one element.
@@ -1849,7 +1849,7 @@ nxml-forward-element
  	  (goto-char
  	   (or (nxml-scan-element-forward (nxml-token-before))
  	       (error "No more elements")))
-	  (setq arg (1- arg)))
+	  (cl-decf arg))
      (nxml-scan-error
       (goto-char (cadr err))
       (apply #'error (cddr err))))))
@@ -1871,7 +1871,7 @@ nxml-backward-element
  						  xmltok-start))
  		    xmltok-start)
  	       (error "No preceding elements")))
-	  (setq arg (1- arg)))
+	  (cl-decf arg))
      (nxml-scan-error
       (goto-char (cadr err))
       (apply #'error (cddr err))))))
@@ -1900,7 +1900,7 @@ nxml-forward-paragraph
  	((> arg 0)
  	 (forward-line 0)
  	 (while (and (nxml-forward-single-paragraph)
-		     (> (setq arg (1- arg)) 0))))))
+		     (> (cl-decf arg) 0))))))

  (defun nxml-backward-paragraph (&optional arg)
    (interactive "^p")
@@ -1912,7 +1912,7 @@ nxml-backward-paragraph
  	   (let ((inhibit-field-text-motion t))
  	     (end-of-line)))
  	 (while (and (nxml-backward-single-paragraph)
-		     (> (setq arg (1- arg)) 0))))))
+		     (> (cl-decf arg) 0))))))

  (defun nxml-forward-single-paragraph ()
    "Move forward over a single paragraph.
@@ -2170,9 +2170,9 @@ nxml-preceding-sibling-data-p
  	    (xmltok-forward)
  	    (let ((prev-level level))
  	      (cond ((eq xmltok-type 'end-tag)
-		     (setq level (1+ level)))
+		     (cl-incf level))
  		    ((eq xmltok-type 'start-tag)
-		     (setq level (1- level))))
+		     (cl-decf level)))
  	      (when (eq prev-level 0)
  		(while (and (< (point) end) (not found))
  		  (xmltok-forward)
@@ -2192,9 +2192,9 @@ nxml-following-sibling-data-p
  		    (nxml-tokenize-forward)
  		    (not found))
  	  (cond ((eq xmltok-type 'start-tag)
-		 (setq level (1+ level)))
+		 (cl-incf level))
  		((eq xmltok-type 'end-tag)
-		 (setq level (1- level)))
+		 (cl-decf level))
  		((and (eq level 0)
  		      (memq xmltok-type '(data cdata-section char-ref)))
  		 (setq found t))))))
diff --git a/lisp/nxml/rng-match.el b/lisp/nxml/rng-match.el
index d2b629e..d9bd71c 100644
--- a/lisp/nxml/rng-match.el
+++ b/lisp/nxml/rng-match.el
@@ -146,7 +146,7 @@ rng-ipattern-clear
    (setq rng-last-ipattern-index -1))

  (defsubst rng-gen-ipattern-index ()
-  (setq rng-last-ipattern-index (1+ rng-last-ipattern-index)))
+  (cl-incf rng-last-ipattern-index))

  (defun rng-put-ipattern (key type name-class child nullable)
    (let ((ipattern
diff --git a/lisp/obsolete/landmark.el b/lisp/obsolete/landmark.el
index 12dadd2..0d248dc 100644
--- a/lisp/obsolete/landmark.el
+++ b/lisp/obsolete/landmark.el
@@ -378,10 +378,10 @@ landmark-strongest-square
         ;; If score is equally good, choose randomly. But first check freedom:
         ((not (zerop (aref landmark-board square)))
  	(aset landmark-score-table square -1))
-       ((zerop (random (setq count (1+ count))))
+       ((zerop (random (cl-incf count)))
  	(setq best-square square
  	      score-max	  score)))
-      (setq square (1+ square)))	; try next square
+      (cl-incf square))	; try next square
      best-square))

  ;;;_  -  INITIALIZING THE SCORE TABLE.
@@ -430,14 +430,14 @@ landmark-init-score-table
  	  (setq j 1)
  	  (while (<= j maxj)
  	    (landmark-init-square-score i j)
-	    (setq j (1+ j)))
-	  (setq i (1+ i)))
+	    (cl-incf j))
+	  (cl-incf i))
  	(while (<= i maxi)
  	  (setq j 1)
  	  (while (<= j maxj2)
  	    (landmark-init-square-score i j)
-	    (setq j (1+ j)))
-	  (setq i (1+ i))))
+	    (cl-incf j))
+	  (cl-incf i)))
        (setq landmark-saved-score-table  (copy-sequence landmark-score-table)
  	    landmark-saved-board-width  landmark-board-width
  	    landmark-saved-board-height landmark-board-height)))
@@ -600,7 +600,7 @@ landmark-play-move
    "Go to SQUARE, play VAL and update everything."
    (setq landmark-emacs-is-computing t)	; Raise flag
    (cond ((= 1 val)			; a Human move
-	 (setq landmark-number-of-human-moves (1+ landmark-number-of-human-moves)))
+	 (cl-incf landmark-number-of-human-moves))
  	((zerop landmark-number-of-moves)	; an Emacs move. Is it first ?
  	 (setq landmark-emacs-played-first t)))
    (setq landmark-game-history
@@ -621,7 +621,7 @@ landmark-take-back
  	 (square (car last-move))
  	 (oldval (aref landmark-board square)))
      (if (= 1 oldval)
-	(setq landmark-number-of-human-moves (1- landmark-number-of-human-moves)))
+	(cl-decf landmark-number-of-human-moves))
      (setq landmark-game-history	 (cdr landmark-game-history)
  	  landmark-number-of-moves (1- landmark-number-of-moves))
      (landmark-plot-square square 0)
@@ -651,7 +651,7 @@ landmark-number-of-draws

  (defun landmark-terminate-game (result)
    "Terminate the current game with RESULT."
-  (setq landmark-number-of-trials (1+ landmark-number-of-trials))
+  (cl-incf landmark-number-of-trials)
    (setq landmark-sum-of-moves (+ landmark-sum-of-moves landmark-number-of-moves))
    (if (eq result 'crash-game)
        (message
@@ -903,7 +903,7 @@ landmark-init-display
      (while (progn
  	     (setq j n
  		   x (- landmark-x-offset landmark-square-width))
-	     (while (>= (setq j (1- j)) 0)
+	     (while (>= (cl-decf j) 0)
  	       (insert-char ?\t (/ (- (setq x (+ x landmark-square-width))
  				      (current-column))
  				   tab-width))
@@ -920,7 +920,7 @@ landmark-init-display
  	       (add-text-properties point (point)
  				    '(mouse-face highlight help-echo "\
  mouse-1: get robot moving, mouse-2: play on this square")))
-	     (> (setq i (1- i)) 0))
+	     (> (cl-decf i) 0))
        (if (= i (1- m))
  	  (setq opoint point))
        (insert-char ?\n landmark-square-height))
@@ -973,10 +973,10 @@ landmark-check-filled-qtuple
  	(depl (landmark-xy-to-index dx dy)))
      (while (and (> a -4)		; stretch tuple left
  		(= value (aref landmark-board (setq left (- left depl)))))
-      (setq a (1- a)))
+      (cl-decf a))
      (while (and (< b (+ a 4))		; stretch tuple right
  		(= value (aref landmark-board (setq right (+ right depl)))))
-      (setq b (1+ b)))
+      (cl-incf b))
      (cond ((= b (+ a 4))		; tuple length = 5 ?
  	   (landmark-cross-qtuple (+ square (* a depl)) (+ square (* b depl))
  				dx dy)
@@ -1002,7 +1002,7 @@ landmark-cross-qtuple
  	   (let ((landmark-n 1)
  		 (column (current-column)))
  	     (while (< landmark-n landmark-square-height)
-	       (setq landmark-n (1+ landmark-n))
+	       (cl-incf landmark-n)
  	       (forward-line 1)
  	       (indent-to column)
  	       (insert ?|))))
diff --git a/lisp/play/pong.el b/lisp/play/pong.el
index bd31983..dea61a9 100644
--- a/lisp/play/pong.el
+++ b/lisp/play/pong.el
@@ -268,7 +268,7 @@ pong-move-left
    (interactive)
    (if (> pong-bat-player1 1)
        (and
-       (setq pong-bat-player1 (1- pong-bat-player1))
+       (cl-decf pong-bat-player1)
         (pong-update-bat 2 pong-bat-player1))))


@@ -278,7 +278,7 @@ pong-move-right
    (interactive)
    (if (< (+ pong-bat-player1 pong-bat-width) (1- pong-height))
        (and
-       (setq pong-bat-player1 (1+ pong-bat-player1))
+       (cl-incf pong-bat-player1)
         (pong-update-bat 2 pong-bat-player1))))


@@ -288,7 +288,7 @@ pong-move-up
    (interactive)
    (if (> pong-bat-player2 1)
        (and
-       (setq pong-bat-player2 (1- pong-bat-player2))
+       (cl-decf pong-bat-player2)
         (pong-update-bat (- pong-width 3) pong-bat-player2))))


@@ -298,7 +298,7 @@ pong-move-down
    (interactive)
    (if (< (+ pong-bat-player2 pong-bat-width) (1- pong-height))
        (and
-       (setq pong-bat-player2 (1+ pong-bat-player2))
+       (cl-incf pong-bat-player2)
         (pong-update-bat (- pong-width 3) pong-bat-player2))))


@@ -391,11 +391,11 @@ pong-update-game
  	(setq pong-yy (- pong-yy)))

         ((< pong-x 1)
-	(setq pong-score-player2 (1+ pong-score-player2))
+	(cl-incf pong-score-player2)
  	(pong-init))

         ((>= pong-x (- pong-width 1))
-	(setq pong-score-player1 (1+ pong-score-player1))
+	(cl-incf pong-score-player1)
  	(pong-init))))))


diff --git a/lisp/play/tetris.el b/lisp/play/tetris.el
index d4ab668..c33ea58 100644
--- a/lisp/play/tetris.el
+++ b/lisp/play/tetris.el
@@ -428,7 +428,7 @@ tetris-shift-row
  (defun tetris-shift-down ()
    (dotimes (y0 tetris-height)
      (when (tetris-full-row y0)
-      (setq tetris-n-rows (1+ tetris-n-rows))
+      (cl-incf tetris-n-rows)
        (cl-loop for y from y0 downto 0 do
                 (tetris-shift-row y)))))

@@ -475,7 +475,7 @@ tetris-reset-game

  (defun tetris-shape-done ()
    (tetris-shift-down)
-  (setq tetris-n-shapes (1+ tetris-n-shapes))
+  (cl-incf tetris-n-shapes)
    (setq tetris-score
  	(+ tetris-score
  	   (aref (aref tetris-shape-scores tetris-shape) tetris-rot)))
@@ -489,10 +489,10 @@ tetris-update-game
  	   (eq (current-buffer) tetris-buffer))
        (let (hit)
  	(tetris-erase-shape)
-	(setq tetris-pos-y (1+ tetris-pos-y))
+	(cl-incf tetris-pos-y)
  	(setq hit (tetris-test-shape))
  	(if hit
-	    (setq tetris-pos-y (1- tetris-pos-y)))
+	    (cl-decf tetris-pos-y))
  	(tetris-draw-shape)
  	(if hit
  	    (tetris-shape-done)))))
@@ -504,9 +504,9 @@ tetris-move-bottom
      (let ((hit nil))
        (tetris-erase-shape)
        (while (not hit)
-        (setq tetris-pos-y (1+ tetris-pos-y))
+        (cl-incf tetris-pos-y)
          (setq hit (tetris-test-shape)))
-      (setq tetris-pos-y (1- tetris-pos-y))
+      (cl-decf tetris-pos-y)
        (tetris-draw-shape)
        (tetris-shape-done))))

@@ -515,9 +515,9 @@ tetris-move-left
    (interactive)
    (unless tetris-paused
      (tetris-erase-shape)
-    (setq tetris-pos-x (1- tetris-pos-x))
+    (cl-decf tetris-pos-x)
      (if (tetris-test-shape)
-        (setq tetris-pos-x (1+ tetris-pos-x)))
+        (cl-incf tetris-pos-x))
      (tetris-draw-shape)))

  (defun tetris-move-right ()
@@ -525,9 +525,9 @@ tetris-move-right
    (interactive)
    (unless tetris-paused
      (tetris-erase-shape)
-    (setq tetris-pos-x (1+ tetris-pos-x))
+    (cl-incf tetris-pos-x)
      (if (tetris-test-shape)
-	(setq tetris-pos-x (1- tetris-pos-x)))
+	(cl-decf tetris-pos-x))
      (tetris-draw-shape)))

  (defun tetris-move-down ()
@@ -535,9 +535,9 @@ tetris-move-down
    (interactive)
    (unless tetris-paused
      (tetris-erase-shape)
-    (setq tetris-pos-y (1+ tetris-pos-y))
+    (cl-incf tetris-pos-y)
      (if (tetris-test-shape)
-	(setq tetris-pos-y (1- tetris-pos-y)))
+	(cl-decf tetris-pos-y))
      (tetris-draw-shape)))

  (defun tetris-rotate-prev ()
diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el
index d6f2679..c5c7bc0 100644
--- a/lisp/progmodes/elisp-mode.el
+++ b/lisp/progmodes/elisp-mode.el
@@ -1480,7 +1480,7 @@ elisp--highlight-function-argument
                                (> index 1) (eq (logand index 1) 1)))
                       (setq index 0))
  		    (t
-		     (setq index (1- index))))))
+		     (cl-decf index)))))
  	(setq end           (length args)
  	      start         (1- end)
  	      argument-face 'font-lock-warning-face
@@ -1559,7 +1559,7 @@ elisp--beginning-of-sexp
  	      (let ((p (point)))
  		(forward-sexp -1)
  		(when (< (point) p)
-		  (setq num-skipped-sexps (1+ num-skipped-sexps))))))
+		  (cl-incf num-skipped-sexps)))))
        (error))
      num-skipped-sexps))

diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el
index 1b78823..88ac0a7 100644
--- a/lisp/progmodes/flymake.el
+++ b/lisp/progmodes/flymake.el
@@ -495,7 +495,7 @@ flymake-create-master-file
  	     patched-source-file-name
  	     (funcall get-incl-dirs-f (file-name-directory master-file-name))
  	     include-regexp))
-      (setq idx (1+ idx)))
+      (cl-incf idx))
      (if found
  	(list master-file-name patched-master-file-name)
        (progn
@@ -646,8 +646,8 @@ flymake-get-line-err-count

      (while (< idx count)
        (when (equal type (flymake-ler-type (nth idx line-err-info-list)))
-	(setq err-count (1+ err-count)))
-      (setq idx (1+ idx)))
+	(cl-incf err-count))
+      (cl-incf idx))
      err-count))

  (defun flymake-get-err-count (err-info-list type)
@@ -657,7 +657,7 @@ flymake-get-err-count
  	 (err-count  0))
      (while (< idx count)
        (setq err-count (+ err-count (flymake-get-line-err-count (nth 1 (nth idx err-info-list)) type)))
-      (setq idx (1+ idx)))
+      (cl-incf idx))
      err-count))

  (defun flymake-fix-line-numbers (err-info-list min-line max-line)
@@ -677,7 +677,7 @@ flymake-fix-line-numbers
  	(setq err-info-list (flymake-set-at err-info-list (1- count)
  					    (flymake-er-make-er line
  								(flymake-er-get-line-err-info-list err-info)))))
-      (setq count (1- count))))
+      (cl-decf count)))
    err-info-list)

  (defun flymake-highlight-err-lines (err-info-list)
@@ -786,7 +786,7 @@ flymake-parse-err-lines
  	  (setq line-err-info (flymake-ler-set-file line-err-info nil))
  	  (setq err-info-list (flymake-add-err-info err-info-list line-err-info))))
        (flymake-log 3 "parsed `%s', %s line-err-info" (nth idx lines) (if line-err-info "got" "no"))
-      (setq idx (1+ idx)))
+      (cl-incf idx))
      err-info-list))

  (defun flymake-split-output (output)
@@ -904,7 +904,7 @@ flymake-find-err-info
  	     (count     (length err-info-list)))

  	(while (and (< pos count) (< (car (nth pos err-info-list)) line-no))
-	  (setq pos (1+ pos)))
+	  (cl-incf pos))
  	(when (and (< pos count) (equal (car (nth pos err-info-list)) line-no))
  	  (setq line-err-info-list (flymake-er-get-line-err-info-list (nth pos err-info-list))))
  	(list line-err-info-list pos))
@@ -929,7 +929,7 @@ flymake-add-line-err-info
      (let* ((count  (length line-err-info-list))
  	   (idx    0))
        (while (and (< idx count) (flymake-line-err-info-is-less-or-equal (nth idx line-err-info-list) line-err-info))
-	(setq idx (1+ idx)))
+	(cl-incf idx))
        (cond ((equal 0     idx)    (setq line-err-info-list (cons line-err-info line-err-info-list)))
  	    (t                    (setq line-err-info-list (flymake-ins-after line-err-info-list (1- idx) line-err-info))))
        line-err-info-list)))
@@ -971,14 +971,14 @@ flymake-get-project-include-dirs-imp
  	   (idx           0)
  	   (inc-dirs      nil))
        (while (and (< idx count) (not (string-match "^INCLUDE_DIRS=.*" (nth idx lines))))
-	(setq idx (1+ idx)))
+	(cl-incf idx))
        (when (< idx count)
  	(let* ((inc-lines  (split-string (nth idx lines) " *-I" t))
  	       (inc-count  (length inc-lines)))
  	  (while (> inc-count 0)
  	    (when (not (string-match "^INCLUDE_DIRS=.*" (nth (1- inc-count) inc-lines)))
  	      (push (replace-regexp-in-string "\"" "" (nth (1- inc-count) inc-lines)) inc-dirs))
-	    (setq inc-count (1- inc-count)))))
+	    (cl-decf inc-count))))
        (flymake-add-project-include-dirs-to-cache basedir inc-dirs)
        inc-dirs)))

@@ -1307,7 +1307,7 @@ flymake-get-next-err-line-no
      (let* ((count  (length err-info-list))
  	   (idx    0))
        (while (and (< idx count) (>= line-no (flymake-er-get-line (nth idx err-info-list))))
-	(setq idx (1+ idx)))
+	(cl-incf idx))
        (if (< idx count)
  	  (flymake-er-get-line (nth idx err-info-list))))))

@@ -1316,7 +1316,7 @@ flymake-get-prev-err-line-no
    (when err-info-list
      (let* ((count (length err-info-list)))
        (while (and (> count 0) (<= line-no (flymake-er-get-line (nth (1- count) err-info-list))))
-	(setq count (1- count)))
+	(cl-decf count))
        (if (> count 0)
  	  (flymake-er-get-line (nth (1- count) err-info-list))))))

@@ -1464,8 +1464,8 @@ flymake-get-full-patched-file-name
  					 (expand-file-name file-name-from-err-msg this-dir)
  					 this-file))
  	    (setq real-name this-real-name)))
-	(setq file-count (1- file-count)))
-      (setq base-dirs-count (1- base-dirs-count)))
+	(cl-decf file-count))
+      (cl-decf base-dirs-count))
      real-name))

  (defun flymake-get-full-nonpatched-file-name (file-name-from-err-msg base-dirs)
@@ -1478,7 +1478,7 @@ flymake-get-full-nonpatched-file-name
  					      (nth (1- base-dirs-count) base-dirs))))
  	    (if (file-exists-p full-name)
  		(setq real-name full-name))
-	    (setq base-dirs-count (1- base-dirs-count))))))
+	    (cl-decf base-dirs-count)))))
      real-name))

  (defun flymake-init-find-buildfile-dir (source-file-name buildfile-name)
diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el
index a2d4f14..c29ab08 100644
--- a/lisp/progmodes/gdb-mi.el
+++ b/lisp/progmodes/gdb-mi.el
@@ -1809,7 +1809,7 @@ gdb-send
                            "\\|,q\\|,quit\\|end\\)$")
                    string)
  		 (> gdb-control-level 0))
-	    (setq gdb-control-level (1- gdb-control-level))))
+	    (cl-decf gdb-control-level)))
      ;; CLI command
      (if (string-match "\\\\$" string)
  	(setq gdb-continuation
@@ -1829,10 +1829,10 @@ gdb-send
                            "\\|,q\\|,quit\\|end\\)$")
                    string)
  	       (> gdb-control-level 0))
-	  (setq gdb-control-level (1- gdb-control-level)))
+	  (cl-decf gdb-control-level))
        (setq gdb-continuation nil)))
    (if (string-match gdb-control-commands-regexp string)
-      (setq gdb-control-level (1+ gdb-control-level))))
+      (cl-incf gdb-control-level)))

  (defun gdb-mi-quote (string)
    "Return STRING quoted properly as an MI argument.
@@ -1850,7 +1850,7 @@ gdb-input
  sent with the same TRIGGER-NAME."
    (when (or (not trigger-name)
              (not (gdb-pending-handler-p trigger-name)))
-    (setq gdb-token-number (1+ gdb-token-number))
+    (cl-incf gdb-token-number)
      (setq command (concat (number-to-string gdb-token-number) command))

      (if gdb-enable-debug (push (list 'send-item command handler-function)
@@ -2062,7 +2062,7 @@ gdbmi-bnf-skip-unrecognized

      (while (and (< prefix-offset acc-length)
                  (gdbmi-is-number (aref gud-marker-acc prefix-offset)))
-      (setq prefix-offset (1+ prefix-offset)))
+      (cl-incf prefix-offset))

      (if (and (< prefix-offset acc-length)
               (not (memq (aref gud-marker-acc prefix-offset)
@@ -2228,7 +2228,7 @@ gdbmi-bnf-result-and-async-record-impl

      (while (and (< prefix-offset acc-length)
                  (gdbmi-is-number (aref gud-marker-acc prefix-offset)))
-      (setq prefix-offset (1+ prefix-offset)))
+      (cl-incf prefix-offset))

      (if (and (< prefix-offset acc-length)
               (member (aref gud-marker-acc prefix-offset) '(?* ?+ ?= ?^))
@@ -2287,7 +2287,7 @@ gdbmi-bnf-incomplete-record-result
          ;; Move gdbmi-bnf-offset past the end of the chunk.
          (setq gdbmi-bnf-offset (+ gdbmi-bnf-offset (length result-str)))
          (when newline-pos
-          (setq gdbmi-bnf-offset (1+ gdbmi-bnf-offset))))
+          (cl-incf gdbmi-bnf-offset)))

        ;; Update the parsing state before invoking the handler in class-command
        ;; to make sure it's not left in an invalid state if the handler was
diff --git a/lisp/progmodes/hideif.el b/lisp/progmodes/hideif.el
index 9fbb7d6..8086a28 100644
--- a/lisp/progmodes/hideif.el
+++ b/lisp/progmodes/hideif.el
@@ -947,9 +947,9 @@ hif-get-argument-list
            (setq parm nil))
        (cond
         ((eq hif-token 'hif-lparen)
-        (setq nest (1+ nest)))
+        (cl-incf nest))
         ((eq hif-token 'hif-rparen)
-        (setq nest (1- nest)))
+        (cl-decf nest))
         ((and (eq hif-token 'hif-comma)
               (= nest 0))
          (push (nreverse parm) parmlist)
@@ -1322,7 +1322,7 @@ backward-ifdef
    (or arg (setq arg 1))
    (if (< arg 0) (forward-ifdef (- arg))
      (while (< 0 arg)
-      (setq arg (1- arg))
+      (cl-decf arg)
        (beginning-of-line)
        (let ((start (point)))
  	(unless (hif-looking-at-endif)
@@ -1363,7 +1363,7 @@ next-ifdef
    (or arg (setq arg 1))
    (if (< arg 0) (previous-ifdef (- arg))
      (while (< 0 arg)
-      (setq arg (1- arg))
+      (cl-decf arg)
        (hif-find-next-relevant)
        (when (eolp)
  	(beginning-of-line)
@@ -1376,7 +1376,7 @@ previous-ifdef
    (or arg (setq arg 1))
    (if (< arg 0) (next-ifdef (- arg))
      (while (< 0 arg)
-      (setq arg (1- arg))
+      (cl-decf arg)
        (let ((start (point)))
  	(hif-find-previous-relevant)
  	(if (= start (point))
diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el
index 5d5d101..3cf7bcf 100644
--- a/lisp/progmodes/js.el
+++ b/lisp/progmodes/js.el
@@ -743,7 +743,7 @@ js--re-search-forward-inner
                    (js--beginning-of-macro))
               (c-end-of-macro))
              (t
-             (setq count (1- count))))))
+             (cl-decf count)))))
    (point))


@@ -798,7 +798,7 @@ js--re-search-backward-inner
                              (>= (point) orig-macro-start)))
                    (js--beginning-of-macro)))
              (t
-             (setq count (1- count))))))
+             (cl-decf count)))))
    (point))


diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index f9b28c3..46530e3 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -654,7 +654,7 @@ python-syntax-count-quotes
      (while (and (< i 3)
                  (or (not limit) (< (+ point i) limit))
                  (eq (char-after (+ point i)) quote-char))
-      (setq i (1+ i)))
+      (cl-incf i))
      i))

  (defun python-syntax-stringify ()
@@ -1440,7 +1440,7 @@ python-nav--forward-defun
                           (re-search-forward
                            python-nav-beginning-of-defun-regexp nil t))
                         '>)))
-      (setq arg (1- arg)))
+      (cl-decf arg))
      (while (and (< arg 0)
                  (setq found
                        (python-nav--syntactically
@@ -1448,7 +1448,7 @@ python-nav--forward-defun
                           (re-search-backward
                            python-nav-beginning-of-defun-regexp nil t))
                         '<)))
-      (setq arg (1+ arg)))
+      (cl-incf arg))
      found))

  (defun python-nav-backward-defun (&optional arg)
@@ -1534,12 +1534,12 @@ python-nav-forward-statement
      (python-nav-end-of-statement)
      (python-util-forward-comment)
      (python-nav-beginning-of-statement)
-    (setq arg (1- arg)))
+    (cl-decf arg))
    (while (< arg 0)
      (python-nav-beginning-of-statement)
      (python-util-forward-comment -1)
      (python-nav-beginning-of-statement)
-    (setq arg (1+ arg))))
+    (cl-incf arg)))

  (defun python-nav-beginning-of-block ()
    "Move to start of current block."
@@ -1601,13 +1601,13 @@ python-nav-forward-block
        (while (and
                (re-search-forward block-start-regexp nil t)
                (python-syntax-context-type)))
-      (setq arg (1- arg)))
+      (cl-decf arg))
      (while (< arg 0)
        (python-nav-beginning-of-statement)
        (while (and
                (re-search-backward block-start-regexp nil t)
                (python-syntax-context-type)))
-      (setq arg (1+ arg)))
+      (cl-incf arg))
      (python-nav-beginning-of-statement)
      (if (not (looking-at (python-rx block-start)))
          (and (goto-char starting-pos) nil)
@@ -1765,10 +1765,10 @@ python-nav-forward-sexp
                  #'python-nav-forward-sexp-safe #'python-nav-backward-sexp))))
    (while (> arg 0)
      (python-nav--forward-sexp 1 safe skip-parens-p)
-    (setq arg (1- arg)))
+    (cl-decf arg))
    (while (< arg 0)
      (python-nav--forward-sexp -1 safe skip-parens-p)
-    (setq arg (1+ arg))))
+    (cl-incf arg)))

  (defun python-nav-backward-sexp (&optional arg safe skip-parens-p)
    "Move backward across expressions.
@@ -1847,10 +1847,10 @@ python-nav-up-list
    (or arg (setq arg 1))
    (while (> arg 0)
      (python-nav--up-list 1)
-    (setq arg (1- arg)))
+    (cl-decf arg))
    (while (< arg 0)
      (python-nav--up-list -1)
-    (setq arg (1+ arg))))
+    (cl-incf arg)))

  (defun python-nav-backward-up-list (&optional arg)
    "Move backward out of one level of parentheses (or blocks).
diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el
index 5d362e4..a935a09 100644
--- a/lisp/progmodes/sh-script.el
+++ b/lisp/progmodes/sh-script.el
@@ -3292,10 +3292,10 @@ sh-find-prev-matching
  		    (skip-chars-forward " \t")))
  	      (cond
  	       ((looking-at open)
-		(setq depth (1- depth))
+		(cl-decf depth)
  		(sh-debug "found open at %d - depth = %d" (point) depth))
  	       ((looking-at close)
-		(setq depth (1+ depth))
+		(cl-incf depth)
  		(sh-debug "found close - depth = %d" depth))
  	       (t
  		))))
@@ -3718,7 +3718,7 @@ sh-learn-buffer-indent
                          sh-basic-offset)))

          (while (< (point) (point-max))
-          (setq linenum (1+ linenum))
+          (cl-incf linenum)
            ;; (if (zerop (% linenum 10))
            (message "line %d" linenum)
            ;; )
@@ -3753,7 +3753,7 @@ sh-learn-buffer-indent
                             (format "  but was previously set to %s"
                                     (nth 1 previous-set-info))
                             (nth 2 previous-set-info) out-buffer t)
-                          (setq num-diffs (1+ num-diffs))
+                          (cl-incf num-diffs)
                            ;; (delete previous-set-info  learned-var-list)
                            (setcdr previous-set-info
                                    (list (symbol-value var) (point)))
@@ -3904,7 +3904,7 @@ sh-guess-basic-offset
  	  (cl-incf (aref totals i) (aref vec (/ i 2))))
        (if (< (* i 2) max)
  	  (cl-incf (aref totals i) (aref vec (* i 2))))
-      (setq i (1+ i)))
+      (cl-incf i))

      (let ((x nil)
  	  (result nil)
@@ -3913,7 +3913,7 @@ sh-guess-basic-offset
        (while (< i max)
  	(if (/= (aref totals i) 0)
  	    (push (cons i (aref totals i)) x))
-	(setq i (1+ i)))
+	(cl-incf i))

        (setq x (sort (nreverse x) (lambda (a b) (> (cdr a) (cdr b)))))
        (setq tot (apply '+ (append totals nil)))
diff --git a/lisp/progmodes/sql.el b/lisp/progmodes/sql.el
index a11d456..ae3954c 100644
--- a/lisp/progmodes/sql.el
+++ b/lisp/progmodes/sql.el
@@ -3586,7 +3586,7 @@ sql-redirect-value
             (let ((i (/ (length (match-data)) 2))
                   (r nil))
               (while (> i 0)
-               (setq i (1- i))
+               (cl-decf i)
                 (push (match-string i) r))
               r))
            ;; one group specified
@@ -4285,7 +4285,7 @@ sql-comint
            (while (sql-buffer-live-p
                    (format "*%s*"
                            (setq buf-name (format "SQL-%s%d" product i))))
-            (setq i (1+ i))))))
+            (cl-incf i)))))
      (set-buffer
       (apply #'make-comint buf-name program nil params))))

diff --git a/lisp/rect.el b/lisp/rect.el
index f9bebc4..527342d 100644
--- a/lisp/rect.el
+++ b/lisp/rect.el
@@ -799,7 +799,7 @@ rectangle--highlight-for-redisplay
                   (setq mright (max mright leftcol)))
                  ((and (> mleft leftcol) ;`leftcol' is in the middle of a char.
                        (eq (char-before left) ?\t))
-                 (setq left (1- left))
+                 (cl-decf left)
                   (move-overlay ol left right)
                   (goto-char left)
                   (overlay-put ol 'before-string (rectangle--space-to leftcol)))
@@ -823,7 +823,7 @@ rectangle--highlight-for-redisplay
                     (overlay-put ol 'after-string str)))
                  ((and (> mright rightcol) ;`rightcol's in the middle of a char.
                        (eq (char-before right) ?\t))
-                 (setq right (1- right))
+                 (cl-decf right)
                   (move-overlay ol left right)
                   (if (= rightcol leftcol)
                       (overlay-put ol 'after-string nil)
diff --git a/lisp/replace.el b/lisp/replace.el
index 60948ef..02a9a75 100644
--- a/lisp/replace.el
+++ b/lisp/replace.el
@@ -987,7 +987,7 @@ how-many
  			 (re-search-forward regexp rend t)))
  	(if (= opoint (point))
  	    (forward-char 1)
-	  (setq count (1+ count))))
+	  (cl-incf count)))
        (when interactive (message "%d occurrence%s"
  				 count
  				 (if (= count 1) "" "s")))
@@ -1226,7 +1226,7 @@ occur-find-match
        (if r
            (goto-char r)
          (error message))
-      (setq n (1- n)))))
+      (cl-decf n))))

  (defun occur-next (&optional n)
    "Move to the Nth (default 1) next match in an Occur mode buffer."
@@ -1499,7 +1499,7 @@ occur-1
  			       (if str
  				   (with-current-buffer occur-buf
  				     (insert str)
-				     (setq count (1+ count))
+				     (cl-incf count)
  				     (or (zerop (current-column))
  					 (insert "\n"))))))))
                         (setq bufs (cdr bufs)))
@@ -1574,7 +1574,7 @@ occur-engine
  		(while (not (eobp))
  		  (setq origpt (point))
  		  (when (setq endpt (re-search-forward regexp nil t))
-		    (setq lines (1+ lines)) ;; increment matching lines count
+		    (cl-incf lines) ;; increment matching lines count
  		    (setq matchbeg (match-beginning 0))
  		    ;; Get beginning of first match line and end of the last.
  		    (save-excursion
@@ -1592,10 +1592,10 @@ occur-engine
  			  (start 0))
  		      ;; Count empty lines that don't use next loop (Bug#22062).
  		      (when (zerop len)
-			(setq matches (1+ matches)))
+			(cl-incf matches))
  		      (while (and (< start len)
  				  (string-match regexp curstring start))
-			(setq matches (1+ matches))
+			(cl-incf matches)
  			(add-text-properties
  			 (match-beginning 0) (match-end 0)
  			 '(occur-match t) curstring)
@@ -2303,11 +2303,11 @@ perform-replace
  		     (not (text-property-not-all
  			   (nth 0 real-match-data) (nth 1 real-match-data)
  			   'read-only nil))))
-	    (setq skip-read-only-count (1+ skip-read-only-count)))
+	    (cl-incf skip-read-only-count))
  	   ;; Optionally filter out matches.
  	   ((not (funcall isearch-filter-predicate
                            (nth 0 real-match-data) (nth 1 real-match-data)))
-	    (setq skip-filtered-count (1+ skip-filtered-count)))
+	    (cl-incf skip-filtered-count))
  	   ;; Optionally ignore invisible matches.
  	   ((not (or (eq search-invisible t)
  		     ;; Don't open overlays for automatic replacements.
@@ -2315,7 +2315,7 @@ perform-replace
  		     ;; Open hidden overlays for interactive replacements.
  		     (not (isearch-range-invisible
  			   (nth 0 real-match-data) (nth 1 real-match-data)))))
-	    (setq skip-invisible-count (1+ skip-invisible-count)))
+	    (cl-incf skip-invisible-count))
  	   (t
  	    ;; Calculate the replacement string, if necessary.
  	    (when replacements
diff --git a/lisp/server.el b/lisp/server.el
index 85d51c8..5151e52 100644
--- a/lisp/server.el
+++ b/lisp/server.el
@@ -467,7 +467,7 @@ server-handle-delete-frame
  	       (>= 1 (let ((frame-num 0))
  		       (dolist (f (frame-list))
  			 (when (eq proc (frame-parameter f 'client))
-			   (setq frame-num (1+ frame-num))))
+			   (cl-incf frame-num)))
  		       frame-num)))
        (server-log (format "server-handle-delete-frame, frame %s" frame) proc)
        (server-delete-client proc 'noframe)))) ; Let delete-frame delete the frame later.
diff --git a/lisp/ses.el b/lisp/ses.el
index c80415e..cab3d78 100644
--- a/lisp/ses.el
+++ b/lisp/ses.el
@@ -1867,7 +1867,7 @@ ses-load
  		   (eq (car-safe x) 'ses-local-printer)
  		   (apply #'ses--local-printer (cdr x)))
  	      (error "local printer-def error"))
-	  (setq ses--numlocprn (1+ ses--numlocprn))))))
+	  (cl-incf ses--numlocprn)))))
    ;; Load cell definitions.
    (dotimes (row ses--numrows)
      (dotimes (col ses--numcols)
@@ -2847,7 +2847,7 @@ ses-delete-column
  	(ses-reprint-all t)
        (ses-setup))
      (if (>= col ses--numcols)
-	(setq col (1- col)))
+	(cl-decf col))
      (ses-goto-print origrow col)))

  (defun ses-forward-or-insert (&optional count)
@@ -3160,7 +3160,7 @@ ses-yank-tsf
        ;;Find all the tabs and newlines
        (while (setq pos (string-match "[\t\n]" text (1+ pos)))
  	(push pos spots)
-	(setq cols (1+ cols))
+	(cl-incf cols)
  	(when (eq (aref text pos) ?\n)
  	  (if (not needcols)
  	      (setq needcols cols)
@@ -3307,7 +3307,7 @@ ses-mark-column
      (push-mark (point) nil t)
      (while (eq '*skip* (ses-cell-value row col))
        ;;Skip over initial cells in column that can't be selected
-      (setq row (1+ row)))
+      (cl-incf row))
      (ses-goto-print row col)))

  (defun ses-end-of-line ()
@@ -3336,7 +3336,7 @@ ses-end-of-line
        (when (< row ses--numrows) ; Otherwise it's a range that includes last cell.
  	(while (eq (ses-cell-value row col) '*skip*)
  	  ;; Back to beginning of multi-column cell.
-	  (setq col (1- col)))
+	  (cl-decf col))
  	(ses-goto-print row col)))))

  (defun ses-renarrow-buffer ()
@@ -3878,7 +3878,7 @@ ses-center-span
    (let ((end (1+ ses--col)))
      (while (and (< end ses--numcols)
  		(memq (ses-cell-value ses--row end) '(nil *skip*)))
-      (setq end (1+ end)))
+      (cl-incf end))
      (ses-center value (- end ses--col 1) fill printer)))

  (defun ses-dashfill (value &optional span printer)
diff --git a/lisp/simple.el b/lisp/simple.el
index fe61325..e20af74 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -503,7 +503,7 @@ open-line
  	     (if do-left-margin (indent-to (current-left-margin)))
  	     (if do-fill-prefix (insert-and-inherit fill-prefix))))
        (forward-line 1)
-      (setq n (1- n)))
+      (cl-decf n))
      (goto-char loc)
      ;; Necessary in case a margin or prefix was inserted.
      (end-of-line)))
@@ -794,7 +794,7 @@ quoted-insert
  	    (delete-char arg)))
      (while (> arg 0)
        (insert-and-inherit char)
-      (setq arg (1- arg)))))
+      (cl-decf arg))))

  (defun forward-to-indentation (&optional arg)
    "Move forward ARG lines and position at first nonblank character."
@@ -1199,7 +1199,7 @@ count-words
  	       (narrow-to-region start end)
  	       (goto-char (point-min))
  	       (while (forward-word-strictly 1)
-		 (setq words (1+ words)))))
+		 (cl-incf words))))
  	   words))
  	((use-region-p)
  	 (call-interactively 'count-words-region))
@@ -1681,7 +1681,7 @@ execute-extended-command--shorter
      (while (and (not binding)
                  (progn
                    (unless candidates
-                    (setq len (1+ len))
+                    (cl-incf len)
                      (setq candidates (execute-extended-command--shorter-1
                                        name len)))
                    ;; Don't show the help message if the binding isn't
@@ -2567,7 +2567,7 @@ primitive-undo
                           (- marker offset)
                           (marker-buffer marker))))
            (_ (error "Unrecognized entry in undo list %S" next))))
-      (setq arg (1- arg)))
+      (cl-decf arg))
      ;; Make sure an apply entry produces at least one undo entry,
      ;; so the test in `undo' for continuing an undo series
      ;; will work right.
@@ -4909,7 +4909,7 @@ backward-delete-char-untabify
  		(insert-char ?\s col)
  		(delete-char 1)))
  	  (forward-char -1)
-	  (setq count (1- count))))))
+	  (cl-decf count)))))
    (let* ((skip (cond ((eq backward-delete-char-untabify-method 'hungry) " \t")
                       ((eq backward-delete-char-untabify-method 'all)
                        " \t\n\r")))
@@ -5055,8 +5055,8 @@ forward-visible-line
  			prop
  		      (or (memq prop buffer-invisibility-spec)
  			  (assq prop buffer-invisibility-spec)))
-		    (setq arg (1+ arg))))
-	      (setq arg (1- arg)))
+		    (cl-incf arg)))
+	      (cl-decf arg))
  	    ;; If invisible text follows, and it is a number of complete lines,
  	    ;; skip it.
  	    (let ((opoint (point)))
@@ -5089,7 +5089,7 @@ forward-visible-line
  			    prop
  			  (or (memq prop buffer-invisibility-spec)
  			      (assq prop buffer-invisibility-spec)))
-		  (setq arg (1+ arg)))))
+		  (cl-incf arg))))
  	    (setq first nil))
  	  ;; If invisible text follows, and it is a number of complete lines,
  	  ;; skip it.
@@ -6289,7 +6289,7 @@ line-move-1
  		      (signal 'end-of-buffer nil)
  		    (setq done t))))
  		(unless done
-		  (setq arg (1- arg))))
+		  (cl-decf arg)))
  	      ;; The logic of this is the same as the loop above,
  	      ;; it just goes in the other direction.
  	      (while (and (< arg 0) (not done))
@@ -6315,7 +6315,7 @@ line-move-1
  		      (signal 'beginning-of-buffer nil)
  		    (setq done t))))
  		(unless done
-		  (setq arg (1+ arg))
+		  (cl-incf arg)
  		  (while (and ;; Don't move over previous invis lines
  			  ;; if our target is the middle of this line.
  			  (or (zerop (or goal-column temporary-goal-column))
@@ -6834,7 +6834,7 @@ transpose-lines
  			   ;; but create newlines if necessary.
  			   (setq arg (forward-line arg))
  			   (if (/= (preceding-char) ?\n)
-			       (setq arg (1+ arg)))
+			       (cl-incf arg))
  			   (if (> arg 0)
  			       (newline arg)))
  		       (forward-line arg))))
@@ -7937,7 +7937,7 @@ next-completion
        ;; Move to start of next one.
        (unless (get-text-property (point) 'mouse-face)
  	(goto-char (next-single-property-change (point) 'mouse-face nil end)))
-      (setq n (1- n)))
+      (cl-decf n))
      (while (and (< n 0) (not (bobp)))
        (let ((prop (get-text-property (1- (point)) 'mouse-face)))
  	;; If in a completion, move to the start of it.
@@ -7951,7 +7951,7 @@ next-completion
  	;; Move to the start of that one.
  	(goto-char (previous-single-property-change
  		    (point) 'mouse-face nil beg))
-	(setq n (1+ n))))))
+	(cl-incf n)))))

  (defun choose-completion (&optional event)
    "Choose the completion at point.
@@ -8016,7 +8016,7 @@ choose-completion-guess-base-position
                      (if completion-ignore-case
                          (setq tail (downcase tail)))
                      (not (string= tail (substring string 0 len)))))
-        (setq len (1- len))
+        (cl-decf len)
          (forward-char 1))
        (point))))

diff --git a/lisp/skeleton.el b/lisp/skeleton.el
index 0e81e2d..a1b2328 100644
--- a/lisp/skeleton.el
+++ b/lisp/skeleton.el
@@ -253,7 +253,7 @@ skeleton-insert
  		       (l2 (list (copy-marker (point) t))))
  		   (while (and l1 (> skeleton-regions 0))
  		     (push (copy-marker (pop l1) t) l2)
-		     (setq skeleton-regions (1- skeleton-regions)))
+		     (cl-decf skeleton-regions))
  		   (sort l2 '<))))
  	 (goto-char (car skeleton-regions))
  	 (setq skeleton-regions (cdr skeleton-regions)))
@@ -570,7 +570,7 @@ skeleton-pair-insert-maybe
  ;;    (while (< i ? )
  ;;      (aset map i nil)
  ;;      (aset map (+ i 128) nil)
-;;      (setq i (1+ i))))
+;;      (cl-incf i)))
  ;;  (run-mode-hooks 'mirror-mode-hook))

  (provide 'skeleton)
diff --git a/lisp/subr.el b/lisp/subr.el
index b23f605..4642938 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -249,7 +249,7 @@ dotimes
               (while (< ,counter ,temp)
                 (let ((,(car spec) ,counter))
                   ,@body)
-               (setq ,counter (1+ ,counter)))
+               (cl-incf ,counter))
               ,@(if (cddr spec)
                     ;; FIXME: This let often leads to "unused var" warnings.
                     `((let ((,(car spec) ,counter)) ,@(cddr spec))))))
@@ -361,7 +361,7 @@ internal--compiler-macro-cXXr
            (error "Compiler macro for cXXr applied to non-cXXr form"))
        (while (> i (match-beginning 0))
          (setq x (list (if (eq (aref n i) ?a) 'car 'cdr) x))
-        (setq i (1- i)))
+        (cl-decf i))
        x)))

  (defun caar (x)
@@ -518,7 +518,7 @@ copy-tree
                 (if (and vecp (vectorp tree)) (copy-tree tree vecp) tree)))
      (if (and vecp (vectorp tree))
  	(let ((i (length (setq tree (copy-sequence tree)))))
-	  (while (>= (setq i (1- i)) 0)
+	  (while (>= (cl-decf i) 0)
  	    (aset tree i (copy-tree (aref tree i) vecp)))
  	  tree)
        tree)))
@@ -671,7 +671,7 @@ suppress-keymap
  	(setq loop ?0)
  	(while (<= loop ?9)
  	  (define-key map (char-to-string loop) 'digit-argument)
-	  (setq loop (1+ loop))))))
+	  (cl-incf loop)))))

  (defun make-composed-keymap (maps &optional parent)
    "Construct a new keymap composed of MAPS and inheriting from PARENT.
@@ -3529,7 +3529,7 @@ looking-back
  			(goto-char pos)
  			(backward-char 1)
  			(looking-at (concat "\\(?:"  regexp "\\)\\'"))))
-	    (setq pos (1- pos)))
+	    (cl-decf pos))
  	  (save-excursion
  	    (goto-char pos)
  	    (looking-at (concat "\\(?:"  regexp "\\)\\'")))))
@@ -3723,7 +3723,7 @@ subst-char-in-string
    (let ((i (length string))
  	(newstr (if inplace string (copy-sequence string))))
      (while (> i 0)
-      (setq i (1- i))
+      (cl-decf i)
        (if (eq (aref newstr i) fromchar)
  	  (aset newstr i tochar)))
      newstr))
@@ -4015,7 +4015,7 @@ collapse-delayed-warnings
      (while delayed-warnings-list
        (setq warning (pop delayed-warnings-list))
        (if (equal warning (car delayed-warnings-list))
-          (setq count (1+ count))
+          (cl-incf count)
          (when (> count 1)
            (setcdr warning (cons (format "%s [%d times]" (cadr warning) count)
                                  (cddr warning)))
@@ -4154,7 +4154,7 @@ forward-whitespace
        (if (re-search-backward "[ \t]+\\|\n" nil 'move)
  	  (or (eq (char-after (match-beginning 0)) ?\n)
  	      (skip-chars-backward " \t")))
-      (setq arg (1+ arg)))))
+      (cl-incf arg))))

  ;;  Symbols

@@ -4170,7 +4170,7 @@ forward-symbol
      (while (< arg 0)
        (if (re-search-backward "\\(\\sw\\|\\s_\\)+" nil 'move)
  	  (skip-syntax-backward "w_"))
-      (setq arg (1+ arg)))))
+      (cl-incf arg))))

  ;;  Syntax blocks

@@ -4183,10 +4183,10 @@ forward-same-syntax
    (while (< arg 0)
      (skip-syntax-backward
       (char-to-string (char-syntax (char-before))))
-    (setq arg (1+ arg)))
+    (cl-incf arg))
    (while (> arg 0)
      (skip-syntax-forward (char-to-string (char-syntax (char-after))))
-    (setq arg (1- arg))))
+    (cl-decf arg)))


  ;;;; Text clones
@@ -4376,7 +4376,7 @@ called-interactively-p
                (setq frame nextframe)
                (setq nextframe (backtrace-frame i 'called-interactively-p))
                ;; (message "Frame %d = %S" i nextframe)
-              (setq i (1+ i)))))
+              (cl-incf i))))
        (funcall get-next-frame) ;; Get the first frame.
        (while
            ;; FIXME: The edebug and advice handling should be made modular and
diff --git a/lisp/tar-mode.el b/lisp/tar-mode.el
index 0520369..95539ca 100644
--- a/lisp/tar-mode.el
+++ b/lisp/tar-mode.el
@@ -355,7 +355,7 @@ tar-parse-octal-long-integer
  	    (setq lo (+ (* lo 8) (- (aref string start) ?0))
  		  hi (+ (* hi 8) (ash lo -16))
  		  lo (logand lo 65535)))
-	(setq start (1+ start)))
+	(cl-incf start))
        (list hi lo))))

  (defun tar-parse-octal-integer-safe (string)
@@ -1111,7 +1111,7 @@ tar-expunge
  	  (while (not (eobp))
  	    (if (looking-at "D")
  		(progn (tar-expunge-internal)
-		       (setq n (1+ n)))
+		       (cl-incf n))
  		(forward-line 1)))
  	  ;; after doing the deletions, add any padding that may be necessary.
  	  (tar-pad-to-blocksize))
diff --git a/lisp/term/x-win.el b/lisp/term/x-win.el
index c8e79e3..ba5e44a 100644
--- a/lisp/term/x-win.el
+++ b/lisp/term/x-win.el
@@ -299,7 +299,7 @@ vendor-specific-keysyms
  (let ((i 160))
    (while (< i 256)
      (puthash i i x-keysym-table)
-    (setq i (1+ i))))
+    (cl-incf i)))

  ;; Table from Kuhn's proposed additions to the `KEYSYM Encoding'
  ;; appendix to the X protocol definition.
diff --git a/lisp/textmodes/flyspell.el b/lisp/textmodes/flyspell.el
index 042b7d4..5bc523d 100644
--- a/lisp/textmodes/flyspell.el
+++ b/lisp/textmodes/flyspell.el
@@ -1694,7 +1694,7 @@ flyspell-goto-next-error
  			(setq r t)
  		      (setq ovs (cdr ovs))))
  		  (not r)))
-      (setq pos (1+ pos)))
+      (cl-incf pos))
      ;; save the current location for next invocation
      (setq flyspell-old-pos-error pos)
      (setq flyspell-old-buffer-error (current-buffer))
@@ -1876,7 +1876,7 @@ flyspell-check-previous-highlighted-word
  		    (setq ov (car ovs))
  		    (setq ovs (cdr ovs))
  		    (if (and (flyspell-overlay-p ov)
-			     (= 0 (setq arg (1- arg))))
+			     (= 0 (cl-decf arg)))
  			(throw 'exit t)))))))
  	(save-excursion
  	  (goto-char pos)
@@ -2377,7 +2377,7 @@ flyspell-maybe-correct-transposition
  	  (setq tmp (aref str i))
  	  (aset str i (aref str (1+ i)))
  	  (aset str (1+ i) tmp)
-	  (setq i (1+ i))))
+	  (cl-incf i)))
        nil)))

  (defun flyspell-maybe-correct-doubling (beg end poss)
@@ -2403,7 +2403,7 @@ flyspell-maybe-correct-doubling
  	    (goto-char (+ beg i))
  	    (delete-char 1)
  	    (throw 'done t))
-	  (setq i (1+ i))))
+	  (cl-incf i)))
        nil)))

  ;;*---------------------------------------------------------------------*/
diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el
index 5d5d422..056f1c8 100644
--- a/lisp/textmodes/ispell.el
+++ b/lisp/textmodes/ispell.el
@@ -2419,7 +2419,7 @@ ispell-command-loop
  		  (let ((com-chars command-characters))
  		    (while com-chars
  		      (if (and (> (car com-chars) ?0) (< (car com-chars) char))
-			  (setq skipped (1+ skipped)))
+			  (cl-incf skipped))
  		      (setq com-chars (cdr com-chars)))
  		    (setq num (- char ?0 skipped)))

@@ -2809,7 +2809,7 @@ ispell-highlight-spelling-error-generic
   highlighting when REFRESH is equal to `block'."
    (and (eq 'block ispell-highlight-p)
         (or (eq 'block refresh)
-	   (setq start (1+ start))))	; On block non-refresh, inc start.
+	   (cl-incf start)))	; On block non-refresh, inc start.
    (let ((modified (buffer-modified-p))	; don't allow this fn to modify buffer
  	(buffer-read-only nil)		; Allow highlighting read-only buffers.
  	(text (buffer-substring-no-properties start end))
@@ -2968,7 +2968,7 @@ ispell-parse-output
                       (substring output (1+ (string-match " " output 1)))))
        (while output
  	(let ((end (string-match ", \\|\\($\\)" output))) ; end of miss/guess.
-	  (setq cur-count (1+ cur-count))
+	  (cl-incf cur-count)
  	  (if (> cur-count count)
  	      (push (substring output 0 end) guess-list)
  	    (push (substring output 0 end) miss-list))
diff --git a/lisp/textmodes/sgml-mode.el b/lisp/textmodes/sgml-mode.el
index 13c3cfb..7b27230 100644
--- a/lisp/textmodes/sgml-mode.el
+++ b/lisp/textmodes/sgml-mode.el
@@ -158,7 +158,7 @@ sgml-mode-map
          (define-key map "'" 'sgml-name-self)))
      (let ((c 127)
  	  (map (nth 1 map)))
-      (while (< (setq c (1+ c)) 256)
+      (while (< (cl-incf c) 256)
  	(aset map c 'sgml-maybe-name-self)))
      (define-key map [menu-bar sgml] (cons "SGML" menu-map))
      (define-key menu-map [sgml-validate] '("Validate" . sgml-validate))
@@ -257,7 +257,7 @@ sgml-char-names-table
      (while (< i 128)
        (setq elt (aref sgml-char-names i))
        (if elt (aset table (make-char 'latin-iso8859-1 i) elt))
-      (setq i (1+ i)))
+      (cl-incf i))
      table)
    "A table for mapping non-ASCII characters into SGML entity names.
  Currently, only Latin-1 characters are supported.")
@@ -626,8 +626,8 @@ sgml-slash-matching
  		  (if (eq tagend (point))
  		      (if (eq level 0)
  			  (setq blinkpos (point))
-			(setq level (1- level)))
-		    (setq level (1+ level)))))))
+			(cl-decf level))
+		    (cl-incf level))))))
  	  (when blinkpos
              (goto-char blinkpos)
              (if (pos-visible-in-window-p)
@@ -769,7 +769,7 @@ sgml-attributes
  	    (if (string= "" attribute)
  		(setq i 0)
  	      (sgml-value (assoc (downcase attribute) alist))
-	      (setq i (1- i))))
+	      (cl-decf i)))
  	  (if (eq (preceding-char) ?\s)
  	      (delete-char -1)))
  	car)))
@@ -842,7 +842,7 @@ sgml-skip-tag-backward
                (forward-char 1)
                (sgml-skip-tag-backward 1)))
          (setq return nil))
-      (setq arg (1- arg)))
+      (cl-decf arg))
      return))

  (defun sgml-forward-sexp (n)
@@ -974,7 +974,7 @@ sgml-skip-tag-forward
  		(goto-char point)
  		(setq return nil)))
  	  (forward-list 1))
-	(setq arg (1- arg)))
+	(cl-decf arg))
        return)))

  (defsubst sgml-looking-back-at (str)
@@ -1029,7 +1029,7 @@ sgml-delete-tag
  	(kill-sexp 1)
  	(if (progn (forward-line 0) (looking-at "\\(?:[ \t]*$\\)\n?"))
  	    (delete-region (match-beginning 0) (match-end 0)))))
-    (setq arg (1- arg))))
+    (cl-decf arg)))


  ;; Put read-only last to enable setting this even when read-only enabled.
diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el
index 4562828..6b2ac31 100644
--- a/lisp/textmodes/tex-mode.el
+++ b/lisp/textmodes/tex-mode.el
@@ -1407,7 +1407,7 @@ tex-validate-buffer
  		    (goto-char (point-min))
  		    ;; Skip "Mismatches:" header line.
  		    (forward-line 1)
-		    (setq num-matches (1+ num-matches))
+		    (cl-incf num-matches)
  		    (insert-buffer-substring buffer start end)
  		    (let (text-beg (text-end (point-marker)))
  		      (forward-char (- start end))
diff --git a/lisp/thumbs.el b/lisp/thumbs.el
index dd50c2d..1993022 100644
--- a/lisp/thumbs.el
+++ b/lisp/thumbs.el
@@ -367,7 +367,7 @@ thumbs-do-thumbs-insertion
      (dolist (img list)
        (thumbs-insert-thumb img
  			   (member img thumbs-marked-list))
-      (when (= 0 (mod (setq i (1+ i)) thumbs-per-line))
+      (when (= 0 (mod (cl-incf i) thumbs-per-line))
  	(newline)))
      (unless (bobp) (newline))
      (if (> diff 0) (message "Type + to display more images."))))
diff --git a/lisp/uniquify.el b/lisp/uniquify.el
index a70c918..321047c 100644
--- a/lisp/uniquify.el
+++ b/lisp/uniquify.el
@@ -349,7 +349,7 @@ uniquify-get-proposed-name
        (let ((file (file-name-nondirectory dirname)))
  	(when (setq dirname (file-name-directory dirname))
  	  (setq dirname (directory-file-name dirname)))
-	(setq n (1- n))
+	(cl-decf n)
  	(push (if (zerop (length file)) ;nil or "".
  		  (prog1 (or (file-remote-p dirname) "")
  		    (setq dirname nil)) ;Could be `dirname' iso "".
diff --git a/lisp/url/url-http.el b/lisp/url/url-http.el
index 81bb9b4..f9c1912 100644
--- a/lisp/url/url-http.el
+++ b/lisp/url/url-http.el
@@ -678,7 +678,7 @@ url-http-parse-headers
  				(old-redirects 0))
  			    (while events
  			      (if (eq (car events) :redirect)
-				  (setq old-redirects (1+ old-redirects)))
+				  (cl-incf old-redirects))
  			      (and (setq events (cdr events))
  				   (setq events (cdr events))))
  			    (< old-redirects url-max-redirections))))
diff --git a/lisp/vc/ediff-init.el b/lisp/vc/ediff-init.el
index b0d5d2f..16adddc 100644
--- a/lisp/vc/ediff-init.el
+++ b/lisp/vc/ediff-init.el
@@ -1714,7 +1714,7 @@ ediff-nonempty-string-p
      (let ((i (length string))
  	  (newstr (if inplace string (copy-sequence string))))
        (while (> i 0)
-	(setq i (1- i))
+	(cl-decf i)
  	(if (eq (aref newstr i) fromchar)
  	    (aset newstr i tochar)))
        newstr)))
diff --git a/lisp/vc/vc-annotate.el b/lisp/vc/vc-annotate.el
index 774453f..3b77bde 100644
--- a/lisp/vc/vc-annotate.el
+++ b/lisp/vc/vc-annotate.el
@@ -636,7 +636,7 @@ vc-annotate-warp-revision
  	(while (and (> revspec 0) newrev)
            (setq newrev (vc-call-backend vc-annotate-backend 'next-revision
                                          (or file vc-annotate-parent-file) newrev))
-          (setq revspec (1- revspec)))
+          (cl-decf revspec))
  	(unless newrev
  	  (message "Cannot increment %d revisions from revision %s"
  		   revspeccopy vc-annotate-parent-rev)))
@@ -645,7 +645,7 @@ vc-annotate-warp-revision
  	(while (and (< revspec 0) newrev)
            (setq newrev (vc-call-backend vc-annotate-backend 'previous-revision
                                          (or file vc-annotate-parent-file) newrev))
-          (setq revspec (1+ revspec)))
+          (cl-incf revspec))
  	(unless newrev
  	  (message "Cannot decrement %d revisions from revision %s"
  		   (- 0 revspeccopy) vc-annotate-parent-rev)))
diff --git a/lisp/wid-edit.el b/lisp/wid-edit.el
index 10b1045..28b6716 100644
--- a/lisp/wid-edit.el
+++ b/lisp/wid-edit.el
@@ -242,7 +242,7 @@ widget-choose
                     (setq some-choice-enabled t)))
  	       ;; Allocate digits to disabled alternatives
  	       ;; so that the digit of a given alternative never varies.
-	       (setq next-digit (1+ next-digit)))
+	       (cl-incf next-digit))
  	     (insert "\nC-g = Quit")
  	     (goto-char (point-min))
  	     (forward-line))
@@ -324,7 +324,7 @@ widget-specify-field
  	(overlay-put overlay 'face face)
  	(overlay-put overlay 'follow-link follow-link)
  	(overlay-put overlay 'help-echo help-echo))
-      (setq to (1- to))
+      (cl-decf to)
        (setq rear-sticky t))
      (let ((overlay (make-overlay from to nil nil rear-sticky)))
        (widget-put widget :field-overlay overlay)
@@ -346,13 +346,13 @@ widget-specify-secret
  	(when size
  	  (while (and (> end begin)
  		      (eq (char-after (1- end)) ?\s))
-	    (setq end (1- end))))
+	    (cl-decf end)))
  	(while (< begin end)
  	  (let ((old (char-after begin)))
  	    (unless (eq old secret)
  	      (subst-char-in-region begin (1+ begin) old secret)
  	      (put-text-property begin (1+ begin) 'secret old))
-	    (setq begin (1+ begin))))))))
+	    (cl-incf begin)))))))

  (defun widget-specify-button (widget from to)
    "Specify button for WIDGET between FROM and TO."
@@ -1040,7 +1040,7 @@ widget-move
      (while (> arg 0)
        (cond ((eobp)
  	     (goto-char (point-min))
-	     (setq wrapped (1+ wrapped)))
+	     (cl-incf wrapped))
  	    (widget-use-overlay-change
  	     (goto-char (next-overlay-change (point))))
  	    (t
@@ -1051,13 +1051,13 @@ widget-move
        (let ((new (widget-tabable-at)))
  	(when new
  	  (unless (eq new old)
-	    (setq arg (1- arg))
+	    (cl-decf arg)
  	    (setq old new)))))
      ;; Backward.
      (while (< arg 0)
        (cond ((bobp)
  	     (goto-char (point-max))
-	     (setq wrapped (1+ wrapped)))
+	     (cl-incf wrapped))
  	    (widget-use-overlay-change
  	     (goto-char (previous-overlay-change (point))))
  	    (t
@@ -1068,7 +1068,7 @@ widget-move
        (let ((new (widget-tabable-at)))
  	(when new
  	  (unless (eq new old)
-	    (setq arg (1+ arg))))))
+	    (cl-incf arg)))))
      (let ((new (widget-tabable-at)))
        (while (eq (widget-tabable-at) new)
  	(backward-char)))
@@ -1252,7 +1252,7 @@ widget-field-text-end
              (with-current-buffer (widget-field-buffer widget)
                (while (and (> to from)
                            (eq (char-after (1- to)) ?\s))
-                (setq to (1- to)))
+                (cl-decf to))
                to))))))

  (defun widget-field-find (pos)
@@ -1980,7 +1980,7 @@ widget-field-value-get
  		(while (< (+ from index) to)
  		  (aset result index
  			(get-char-property (+ from index) 'secret))
-		  (setq index (1+ index)))))
+		  (cl-incf index))))
  	    (set-buffer old)
  	    result))
        (widget-get widget :value))))
diff --git a/lisp/woman.el b/lisp/woman.el
index 45b03a9..7161940 100644
--- a/lisp/woman.el
+++ b/lisp/woman.el
@@ -1415,7 +1415,7 @@ woman-topic-all-completions
        (if (woman-not-member dir path)	; use each directory only once!
  	  (push (woman-topic-all-completions-1 dir path-index)
  		files))
-      (setq path-index (1+ path-index)))
+      (cl-incf path-index))
      ;; Uniquify topics:
      ;; Concatenate all lists with a single nconc call to
      ;; avoid retraversing the first lists repeatedly  -- dak
@@ -2025,12 +2025,12 @@ WoMan-previous-manpage
    (WoMan-find-buffer)			; find current existing buffer
    (if (null (cdr woman-buffer-alist))
        (error "No previous WoMan buffer"))
-  (if (>= (setq woman-buffer-number (1+ woman-buffer-number))
+  (if (>= (cl-incf woman-buffer-number)
  	 (length woman-buffer-alist))
        (setq woman-buffer-number 0))
    (if (WoMan-find-buffer)
        ()
-    (if (< (setq woman-buffer-number (1- woman-buffer-number)) 0)
+    (if (< (cl-decf woman-buffer-number) 0)
  	(setq woman-buffer-number (1- (length woman-buffer-alist))))
      (WoMan-previous-manpage)))

@@ -2041,7 +2041,7 @@ WoMan-next-manpage
    (WoMan-find-buffer)			; find current existing buffer
    (if (null (cdr woman-buffer-alist))
        (error "No next WoMan buffer"))
-  (if (< (setq woman-buffer-number (1- woman-buffer-number)) 0)
+  (if (< (cl-decf woman-buffer-number) 0)
        (setq woman-buffer-number (1- (length woman-buffer-alist))))
    (if (WoMan-find-buffer)
        ()
@@ -2415,7 +2415,7 @@ woman-horizontal-escapes
  	    ;; Move backwards by deleting space,
  	    ;; first backwards then forwards:
  	    (while (and
-		    (<= (setq N (1+ N)) 0)
+		    (<= (cl-incf N) 0)
  		    (cond ((memq (preceding-char) '(?\s ?\t))
  			   (delete-char -1) t)
  			  ((memq (following-char) '(?\s ?\t))
@@ -2783,7 +2783,7 @@ woman-interpolate-macro
      (setq macro (cdr macro))
      (while (not (eolp))
        ;; Get next actual arg:
-      (setq argno (1+ argno))
+      (cl-incf argno)
        (setq argno-string (format "%d" argno))
        (setq formal-arg (concat "\\\\\\$" argno-string)) ; regexp
        (setq from (point))
@@ -2986,7 +2986,7 @@ woman-display-extended-fonts
  	  (put-text-property (1- (point)) (point)
  			     'face 'woman-symbol)
  	  (insert "   ")
-	  (setq i (1+ i))
+	  (cl-incf i)
  	  (when (= i 128) (setq i 160) (insert "\n"))
  	  (if (zerop (% i 8)) (insert "\n")))))
      (help-print-return-message)))
@@ -3893,7 +3893,7 @@ woman-negative-vertical-space
  		    "Character(s) overwritten by negative vertical spacing in line %d"
  		    (count-lines 1 (point))))
  		 (delete-char 1) (insert (substring overlap i (1+ i)))))
-	  (setq i (1+ i)))))))
+	  (cl-incf i))))))


  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-- 
2.10.2

;;;;;; ****************************** PATCH ENDS ******************************

In GNU Emacs 26.0.50.30 (x86_64-pc-linux-gnu, GTK+ Version 3.22.2)
  of 2016-11-10 built on calancha-pc
Repository revision: 2bb02a3782e4cc61575f5bc9860f18be63a65a81



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2016-11-10  6:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-10  6:13 [PATCH] Use cl-incf/cl-decf in files that require cl-lib Tino Calancha

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.