aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/vc
diff options
context:
space:
mode:
authorStefan Monnier2012-07-10 07:51:54 -0400
committerStefan Monnier2012-07-10 07:51:54 -0400
commitf58e0fd503567288bb30e243595acaa589034929 (patch)
treee40cb0a5c087c0af4bdd41948d655358b0fcd56e /lisp/vc
parentdfa96edd13d1db4a90fa0977d06b6bdeab2f642e (diff)
downloademacs-f58e0fd503567288bb30e243595acaa589034929.tar.gz
emacs-f58e0fd503567288bb30e243595acaa589034929.zip
Reduce use of (require 'cl).
* admin/bzrmerge.el: Use cl-lib. * leim/quail/hangul.el: Don't require CL. * leim/quail/ipa.el: Use cl-lib. * vc/smerge-mode.el, vc/pcvs.el, vc/pcvs-util.el, vc/pcvs-info.el: * vc/diff-mode.el, vc/cvs-status.el, uniquify.el, scroll-bar.el: * register.el, progmodes/sh-script.el, net/gnutls.el, net/dbus.el: * msb.el, mpc.el, minibuffer.el, international/ucs-normalize.el: * international/quail.el, info-xref.el, imenu.el, image-mode.el: * font-lock.el, filesets.el, edmacro.el, doc-view.el, bookmark.el: * battery.el, avoid.el, abbrev.el: Use cl-lib. * vc/pcvs-parse.el, vc/pcvs-defs.el, vc/log-view.el, vc/log-edit.el: * vc/diff.el, simple.el, pcomplete.el, lpr.el, comint.el, loadhist.el: * jit-lock.el, international/iso-ascii.el, info.el, frame.el, bs.el: * emulation/crisp.el, electric.el, dired.el, cus-dep.el, composite.el: * calculator.el, autorevert.el, apropos.el: Don't require CL. * emacs-bytecomp.el (byte-recompile-directory, display-call-tree) (byte-compile-unfold-bcf, byte-compile-check-variable): * emacs-byte-opt.el (byte-compile-trueconstp) (byte-compile-nilconstp): * emacs-autoload.el (make-autoload): Use pcase. * face-remap.el (text-scale-adjust): Simplify pcase patterns.
Diffstat (limited to 'lisp/vc')
-rw-r--r--lisp/vc/cvs-status.el72
-rw-r--r--lisp/vc/diff-mode.el191
-rw-r--r--lisp/vc/diff.el2
-rw-r--r--lisp/vc/log-edit.el1
-rw-r--r--lisp/vc/log-view.el1
-rw-r--r--lisp/vc/pcvs-defs.el1
-rw-r--r--lisp/vc/pcvs-info.el38
-rw-r--r--lisp/vc/pcvs-parse.el12
-rw-r--r--lisp/vc/pcvs-util.el24
-rw-r--r--lisp/vc/pcvs.el74
-rw-r--r--lisp/vc/smerge-mode.el18
11 files changed, 217 insertions, 217 deletions
diff --git a/lisp/vc/cvs-status.el b/lisp/vc/cvs-status.el
index f803cc43441..6c6b18a605d 100644
--- a/lisp/vc/cvs-status.el
+++ b/lisp/vc/cvs-status.el
@@ -28,7 +28,7 @@
28 28
29;;; Code: 29;;; Code:
30 30
31(eval-when-compile (require 'cl)) 31(eval-when-compile (require 'cl-lib))
32(require 'pcvs-util) 32(require 'pcvs-util)
33 33
34;;; 34;;;
@@ -165,7 +165,7 @@
165;; Tagelt, tag element 165;; Tagelt, tag element
166;; 166;;
167 167
168(defstruct (cvs-tag 168(cl-defstruct (cvs-tag
169 (:constructor nil) 169 (:constructor nil)
170 (:constructor cvs-tag-make 170 (:constructor cvs-tag-make
171 (vlist &optional name type)) 171 (vlist &optional name type))
@@ -235,9 +235,9 @@ The tree will be printed no closer than column COLUMN."
235 (save-excursion 235 (save-excursion
236 (or (= (forward-line 1) 0) (insert "\n")) 236 (or (= (forward-line 1) 0) (insert "\n"))
237 (cvs-tree-print rest printer column)))) 237 (cvs-tree-print rest printer column))))
238 (assert (>= prefix column)) 238 (cl-assert (>= prefix column))
239 (move-to-column prefix t) 239 (move-to-column prefix t)
240 (assert (eolp)) 240 (cl-assert (eolp))
241 (insert (cvs-car name)) 241 (insert (cvs-car name))
242 (dolist (br (cvs-cdr rev)) 242 (dolist (br (cvs-cdr rev))
243 (let* ((column (current-column)) 243 (let* ((column (current-column))
@@ -258,7 +258,7 @@ The tree will be printed no closer than column COLUMN."
258(defun cvs-tree-merge (tree1 tree2) 258(defun cvs-tree-merge (tree1 tree2)
259 "Merge tags trees TREE1 and TREE2 into one. 259 "Merge tags trees TREE1 and TREE2 into one.
260BEWARE: because of stability issues, this is not a symmetric operation." 260BEWARE: because of stability issues, this is not a symmetric operation."
261 (assert (and (listp tree1) (listp tree2))) 261 (cl-assert (and (listp tree1) (listp tree2)))
262 (cond 262 (cond
263 ((null tree1) tree2) 263 ((null tree1) tree2)
264 ((null tree2) tree1) 264 ((null tree2) tree1)
@@ -273,10 +273,10 @@ BEWARE: because of stability issues, this is not a symmetric operation."
273 (l2 (length vl2))) 273 (l2 (length vl2)))
274 (cond 274 (cond
275 ((= l1 l2) 275 ((= l1 l2)
276 (case (cvs-tag-compare tag1 tag2) 276 (pcase (cvs-tag-compare tag1 tag2)
277 (more1 (list* rev2 (cvs-tree-merge tree1 (cdr tree2)))) 277 (`more1 (cons rev2 (cvs-tree-merge tree1 (cdr tree2))))
278 (more2 (list* rev1 (cvs-tree-merge (cdr tree1) tree2))) 278 (`more2 (cons rev1 (cvs-tree-merge (cdr tree1) tree2)))
279 (equal 279 (`equal
280 (cons (cons (cvs-tag-merge tag1 tag2) 280 (cons (cons (cvs-tag-merge tag1 tag2)
281 (cvs-tree-merge (cvs-cdr rev1) (cvs-cdr rev2))) 281 (cvs-tree-merge (cvs-cdr rev1) (cvs-cdr rev2)))
282 (cvs-tree-merge (cdr tree1) (cdr tree2)))))) 282 (cvs-tree-merge (cdr tree1) (cdr tree2))))))
@@ -399,35 +399,35 @@ the list is a three-string list TAG, KIND, REV."
399Otherwise, default to ASCII chars like +, - and |.") 399Otherwise, default to ASCII chars like +, - and |.")
400 400
401(defconst cvs-tree-char-space 401(defconst cvs-tree-char-space
402 (case cvs-tree-use-charset 402 (pcase cvs-tree-use-charset
403 (jisx0208 (make-char 'japanese-jisx0208 33 33)) 403 (`jisx0208 (make-char 'japanese-jisx0208 33 33))
404 (unicode " ") 404 (`unicode " ")
405 (t " "))) 405 (_ " ")))
406(defconst cvs-tree-char-hbar 406(defconst cvs-tree-char-hbar
407 (case cvs-tree-use-charset 407 (pcase cvs-tree-use-charset
408 (jisx0208 (make-char 'japanese-jisx0208 40 44)) 408 (`jisx0208 (make-char 'japanese-jisx0208 40 44))
409 (unicode "━") 409 (`unicode "━")
410 (t "--"))) 410 (_ "--")))
411(defconst cvs-tree-char-vbar 411(defconst cvs-tree-char-vbar
412 (case cvs-tree-use-charset 412 (pcase cvs-tree-use-charset
413 (jisx0208 (make-char 'japanese-jisx0208 40 45)) 413 (`jisx0208 (make-char 'japanese-jisx0208 40 45))
414 (unicode "┃") 414 (`unicode "┃")
415 (t "| "))) 415 (_ "| ")))
416(defconst cvs-tree-char-branch 416(defconst cvs-tree-char-branch
417 (case cvs-tree-use-charset 417 (pcase cvs-tree-use-charset
418 (jisx0208 (make-char 'japanese-jisx0208 40 50)) 418 (`jisx0208 (make-char 'japanese-jisx0208 40 50))
419 (unicode "┣") 419 (`unicode "┣")
420 (t "+-"))) 420 (_ "+-")))
421(defconst cvs-tree-char-eob ;end of branch 421(defconst cvs-tree-char-eob ;end of branch
422 (case cvs-tree-use-charset 422 (pcase cvs-tree-use-charset
423 (jisx0208 (make-char 'japanese-jisx0208 40 49)) 423 (`jisx0208 (make-char 'japanese-jisx0208 40 49))
424 (unicode "┗") 424 (`unicode "┗")
425 (t "`-"))) 425 (_ "`-")))
426(defconst cvs-tree-char-bob ;beginning of branch 426(defconst cvs-tree-char-bob ;beginning of branch
427 (case cvs-tree-use-charset 427 (pcase cvs-tree-use-charset
428 (jisx0208 (make-char 'japanese-jisx0208 40 51)) 428 (`jisx0208 (make-char 'japanese-jisx0208 40 51))
429 (unicode "┳") 429 (`unicode "┳")
430 (t "+-"))) 430 (_ "+-")))
431 431
432(defun cvs-tag-lessp (tag1 tag2) 432(defun cvs-tag-lessp (tag1 tag2)
433 (eq (cvs-tag-compare tag1 tag2) 'more2)) 433 (eq (cvs-tag-compare tag1 tag2) 'more2))
@@ -485,9 +485,9 @@ Optional prefix ARG chooses between two representations."
485 (pe t) ;"prev equal" 485 (pe t) ;"prev equal"
486 (nas nil)) ;"next afters" to be returned 486 (nas nil)) ;"next afters" to be returned
487 (insert " ") 487 (insert " ")
488 (do* ((vs vlist (cdr vs)) 488 (cl-do* ((vs vlist (cdr vs))
489 (ps prev (cdr ps)) 489 (ps prev (cdr ps))
490 (as after (cdr as))) 490 (as after (cdr as)))
491 ((and (null as) (null vs) (null ps)) 491 ((and (null as) (null vs) (null ps))
492 (let ((revname (cvs-status-vl-to-str vlist))) 492 (let ((revname (cvs-status-vl-to-str vlist)))
493 (if (cvs-every 'identity (cvs-map 'equal prev vlist)) 493 (if (cvs-every 'identity (cvs-map 'equal prev vlist))
diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el
index 9034ffe520f..a9d124700b8 100644
--- a/lisp/vc/diff-mode.el
+++ b/lisp/vc/diff-mode.el
@@ -53,7 +53,7 @@
53;; - Handle `diff -b' output in context->unified. 53;; - Handle `diff -b' output in context->unified.
54 54
55;;; Code: 55;;; Code:
56(eval-when-compile (require 'cl)) 56(eval-when-compile (require 'cl-lib))
57 57
58(defvar add-log-buffer-file-name-function) 58(defvar add-log-buffer-file-name-function)
59 59
@@ -493,14 +493,15 @@ See http://lists.gnu.org/archive/html/emacs-devel/2007-11/msg01990.html")
493 ;; We may have a first evaluation of `end' thanks to the hunk header. 493 ;; We may have a first evaluation of `end' thanks to the hunk header.
494 (unless end 494 (unless end
495 (setq end (and (re-search-forward 495 (setq end (and (re-search-forward
496 (case style 496 (pcase style
497 (unified (concat (if diff-valid-unified-empty-line 497 (`unified
498 "^[^-+# \\\n]\\|" "^[^-+# \\]\\|") 498 (concat (if diff-valid-unified-empty-line
499 ;; A `unified' header is ambiguous. 499 "^[^-+# \\\n]\\|" "^[^-+# \\]\\|")
500 diff-file-header-re)) 500 ;; A `unified' header is ambiguous.
501 (context "^[^-+#! \\]") 501 diff-file-header-re))
502 (normal "^[^<>#\\]") 502 (`context "^[^-+#! \\]")
503 (t "^[^-+#!<> \\]")) 503 (`normal "^[^<>#\\]")
504 (_ "^[^-+#!<> \\]"))
504 nil t) 505 nil t)
505 (match-beginning 0))) 506 (match-beginning 0)))
506 (when diff-valid-unified-empty-line 507 (when diff-valid-unified-empty-line
@@ -710,7 +711,7 @@ data such as \"Index: ...\" and such."
710 (save-excursion 711 (save-excursion
711 (let ((n 0)) 712 (let ((n 0))
712 (goto-char start) 713 (goto-char start)
713 (while (re-search-forward re end t) (incf n)) 714 (while (re-search-forward re end t) (cl-incf n))
714 n))) 715 n)))
715 716
716(defun diff-splittable-p () 717(defun diff-splittable-p ()
@@ -834,16 +835,16 @@ PREFIX is only used internally: don't use it."
834 ;; use any previously used preference 835 ;; use any previously used preference
835 (cdr (assoc fs diff-remembered-files-alist)) 836 (cdr (assoc fs diff-remembered-files-alist))
836 ;; try to be clever and use previous choices as an inspiration 837 ;; try to be clever and use previous choices as an inspiration
837 (dolist (rf diff-remembered-files-alist) 838 (cl-dolist (rf diff-remembered-files-alist)
838 (let ((newfile (diff-merge-strings (caar rf) (car fs) (cdr rf)))) 839 (let ((newfile (diff-merge-strings (caar rf) (car fs) (cdr rf))))
839 (if (and newfile (file-exists-p newfile)) (return newfile)))) 840 (if (and newfile (file-exists-p newfile)) (cl-return newfile))))
840 ;; look for each file in turn. If none found, try again but 841 ;; look for each file in turn. If none found, try again but
841 ;; ignoring the first level of directory, ... 842 ;; ignoring the first level of directory, ...
842 (do* ((files fs (delq nil (mapcar 'diff-filename-drop-dir files))) 843 (cl-do* ((files fs (delq nil (mapcar 'diff-filename-drop-dir files)))
843 (file nil nil)) 844 (file nil nil))
844 ((or (null files) 845 ((or (null files)
845 (setq file (do* ((files files (cdr files)) 846 (setq file (cl-do* ((files files (cdr files))
846 (file (car files) (car files))) 847 (file (car files) (car files)))
847 ;; Use file-regular-p to avoid 848 ;; Use file-regular-p to avoid
848 ;; /dev/null, directories, etc. 849 ;; /dev/null, directories, etc.
849 ((or (null file) (file-regular-p file)) 850 ((or (null file) (file-regular-p file))
@@ -862,7 +863,7 @@ PREFIX is only used internally: don't use it."
862 (diff-find-file-name old noprompt (match-string 1))) 863 (diff-find-file-name old noprompt (match-string 1)))
863 ;; if all else fails, ask the user 864 ;; if all else fails, ask the user
864 (unless noprompt 865 (unless noprompt
865 (let ((file (expand-file-name (or (first fs) "")))) 866 (let ((file (expand-file-name (or (car fs) ""))))
866 (setq file 867 (setq file
867 (read-file-name (format "Use file %s: " file) 868 (read-file-name (format "Use file %s: " file)
868 (file-name-directory file) file t 869 (file-name-directory file) file t
@@ -940,21 +941,23 @@ else cover the whole buffer."
940 (let ((modif nil) last-pt) 941 (let ((modif nil) last-pt)
941 (while (progn (setq last-pt (point)) 942 (while (progn (setq last-pt (point))
942 (= (forward-line -1) 0)) 943 (= (forward-line -1) 0))
943 (case (char-after) 944 (pcase (char-after)
944 (?\s (insert " ") (setq modif nil) (backward-char 1)) 945 (?\s (insert " ") (setq modif nil) (backward-char 1))
945 (?+ (delete-region (point) last-pt) (setq modif t)) 946 (?+ (delete-region (point) last-pt) (setq modif t))
946 (?- (if (not modif) 947 (?- (if (not modif)
947 (progn (forward-char 1) 948 (progn (forward-char 1)
948 (insert " ")) 949 (insert " "))
949 (delete-char 1) 950 (delete-char 1)
950 (insert "! ")) 951 (insert "! "))
951 (backward-char 2)) 952 (backward-char 2))
952 (?\\ (when (save-excursion (forward-line -1) 953 (?\\ (when (save-excursion (forward-line -1)
953 (= (char-after) ?+)) 954 (= (char-after) ?+))
954 (delete-region (point) last-pt) (setq modif t))) 955 (delete-region (point) last-pt)
956 (setq modif t)))
955 ;; diff-valid-unified-empty-line. 957 ;; diff-valid-unified-empty-line.
956 (?\n (insert " ") (setq modif nil) (backward-char 2)) 958 (?\n (insert " ") (setq modif nil)
957 (t (setq modif nil)))))) 959 (backward-char 2))
960 (_ (setq modif nil))))))
958 (goto-char (point-max)) 961 (goto-char (point-max))
959 (save-excursion 962 (save-excursion
960 (insert "--- " line2 "," 963 (insert "--- " line2 ","
@@ -967,7 +970,8 @@ else cover the whole buffer."
967 (if (not (save-excursion (re-search-forward "^+" nil t))) 970 (if (not (save-excursion (re-search-forward "^+" nil t)))
968 (delete-region (point) (point-max)) 971 (delete-region (point) (point-max))
969 (let ((modif nil) (delete nil)) 972 (let ((modif nil) (delete nil))
970 (if (save-excursion (re-search-forward "^\\+.*\n-" nil t)) 973 (if (save-excursion (re-search-forward "^\\+.*\n-"
974 nil t))
971 ;; Normally, lines in a substitution come with 975 ;; Normally, lines in a substitution come with
972 ;; first the removals and then the additions, and 976 ;; first the removals and then the additions, and
973 ;; the context->unified function follows this 977 ;; the context->unified function follows this
@@ -976,22 +980,22 @@ else cover the whole buffer."
976 ;; context->unified as an undo command. 980 ;; context->unified as an undo command.
977 (setq reversible nil)) 981 (setq reversible nil))
978 (while (not (eobp)) 982 (while (not (eobp))
979 (case (char-after) 983 (pcase (char-after)
980 (?\s (insert " ") (setq modif nil) (backward-char 1)) 984 (?\s (insert " ") (setq modif nil) (backward-char 1))
981 (?- (setq delete t) (setq modif t)) 985 (?- (setq delete t) (setq modif t))
982 (?+ (if (not modif) 986 (?+ (if (not modif)
983 (progn (forward-char 1) 987 (progn (forward-char 1)
984 (insert " ")) 988 (insert " "))
985 (delete-char 1) 989 (delete-char 1)
986 (insert "! ")) 990 (insert "! "))
987 (backward-char 2)) 991 (backward-char 2))
988 (?\\ (when (save-excursion (forward-line 1) 992 (?\\ (when (save-excursion (forward-line 1)
989 (not (eobp))) 993 (not (eobp)))
990 (setq delete t) (setq modif t))) 994 (setq delete t) (setq modif t)))
991 ;; diff-valid-unified-empty-line. 995 ;; diff-valid-unified-empty-line.
992 (?\n (insert " ") (setq modif nil) (backward-char 2) 996 (?\n (insert " ") (setq modif nil) (backward-char 2)
993 (setq reversible nil)) 997 (setq reversible nil))
994 (t (setq modif nil))) 998 (_ (setq modif nil)))
995 (let ((last-pt (point))) 999 (let ((last-pt (point)))
996 (forward-line 1) 1000 (forward-line 1)
997 (when delete 1001 (when delete
@@ -1051,17 +1055,18 @@ With a prefix argument, convert unified format to context format."
1051 (goto-char pt1) 1055 (goto-char pt1)
1052 (forward-line 1) 1056 (forward-line 1)
1053 (while (< (point) pt2) 1057 (while (< (point) pt2)
1054 (case (char-after) 1058 (pcase (char-after)
1055 (?! (delete-char 2) (insert "-") (forward-line 1)) 1059 (?! (delete-char 2) (insert "-") (forward-line 1))
1056 (?- (forward-char 1) (delete-char 1) (forward-line 1)) 1060 (?- (forward-char 1) (delete-char 1) (forward-line 1))
1057 (?\s ;merge with the other half of the chunk 1061 (?\s ;merge with the other half of the chunk
1058 (let* ((endline2 1062 (let* ((endline2
1059 (save-excursion 1063 (save-excursion
1060 (goto-char pt2) (forward-line 1) (point)))) 1064 (goto-char pt2) (forward-line 1) (point))))
1061 (case (char-after pt2) 1065 (pcase (char-after pt2)
1062 ((?! ?+) 1066 ((or ?! ?+)
1063 (insert "+" 1067 (insert "+"
1064 (prog1 (buffer-substring (+ pt2 2) endline2) 1068 (prog1
1069 (buffer-substring (+ pt2 2) endline2)
1065 (delete-region pt2 endline2)))) 1070 (delete-region pt2 endline2))))
1066 (?\s 1071 (?\s
1067 (unless (= (- endline2 pt2) 1072 (unless (= (- endline2 pt2)
@@ -1075,9 +1080,9 @@ With a prefix argument, convert unified format to context format."
1075 (delete-char 1) 1080 (delete-char 1)
1076 (forward-line 1)) 1081 (forward-line 1))
1077 (?\\ (forward-line 1)) 1082 (?\\ (forward-line 1))
1078 (t (setq reversible nil) 1083 (_ (setq reversible nil)
1079 (delete-char 1) (forward-line 1))))) 1084 (delete-char 1) (forward-line 1)))))
1080 (t (setq reversible nil) (forward-line 1)))) 1085 (_ (setq reversible nil) (forward-line 1))))
1081 (while (looking-at "[+! ] ") 1086 (while (looking-at "[+! ] ")
1082 (if (/= (char-after) ?!) (forward-char 1) 1087 (if (/= (char-after) ?!) (forward-char 1)
1083 (delete-char 1) (insert "+")) 1088 (delete-char 1) (insert "+"))
@@ -1155,13 +1160,13 @@ else cover the whole buffer."
1155 (replace-match "@@ -\\8 +\\7 @@" nil) 1160 (replace-match "@@ -\\8 +\\7 @@" nil)
1156 (forward-line 1) 1161 (forward-line 1)
1157 (let ((c (char-after)) first last) 1162 (let ((c (char-after)) first last)
1158 (while (case (setq c (char-after)) 1163 (while (pcase (setq c (char-after))
1159 (?- (setq first (or first (point))) 1164 (?- (setq first (or first (point)))
1160 (delete-char 1) (insert "+") t) 1165 (delete-char 1) (insert "+") t)
1161 (?+ (setq last (or last (point))) 1166 (?+ (setq last (or last (point)))
1162 (delete-char 1) (insert "-") t) 1167 (delete-char 1) (insert "-") t)
1163 ((?\\ ?#) t) 1168 ((or ?\\ ?#) t)
1164 (t (when (and first last (< first last)) 1169 (_ (when (and first last (< first last))
1165 (insert (delete-and-extract-region first last))) 1170 (insert (delete-and-extract-region first last)))
1166 (setq first nil last nil) 1171 (setq first nil last nil)
1167 (memq c (if diff-valid-unified-empty-line 1172 (memq c (if diff-valid-unified-empty-line
@@ -1184,13 +1189,13 @@ else cover the whole buffer."
1184 (concat diff-hunk-header-re-unified 1189 (concat diff-hunk-header-re-unified
1185 "\\|[-*][-*][-*] [0-9,]+ [-*][-*][-*][-*]$" 1190 "\\|[-*][-*][-*] [0-9,]+ [-*][-*][-*][-*]$"
1186 "\\|--- .+\n\\+\\+\\+ "))) 1191 "\\|--- .+\n\\+\\+\\+ ")))
1187 (case (char-after) 1192 (pcase (char-after)
1188 (?\s (incf space)) 1193 (?\s (cl-incf space))
1189 (?+ (incf plus)) 1194 (?+ (cl-incf plus))
1190 (?- (incf minus)) 1195 (?- (cl-incf minus))
1191 (?! (incf bang)) 1196 (?! (cl-incf bang))
1192 ((?\\ ?#) nil) 1197 ((or ?\\ ?#) nil)
1193 (t (setq space 0 plus 0 minus 0 bang 0))) 1198 (_ (setq space 0 plus 0 minus 0 bang 0)))
1194 (cond 1199 (cond
1195 ((looking-at diff-hunk-header-re-unified) 1200 ((looking-at diff-hunk-header-re-unified)
1196 (let* ((old1 (match-string 2)) 1201 (let* ((old1 (match-string 2))
@@ -1432,7 +1437,7 @@ Only works for unified diffs."
1432 (cond 1437 (cond
1433 ((and (memq (char-after) '(?\s ?! ?+ ?-)) 1438 ((and (memq (char-after) '(?\s ?! ?+ ?-))
1434 (memq (char-after (1+ (point))) '(?\s ?\t))) 1439 (memq (char-after (1+ (point))) '(?\s ?\t)))
1435 (decf count) t) 1440 (cl-decf count) t)
1436 ((or (zerop count) (= count lines)) nil) 1441 ((or (zerop count) (= count lines)) nil)
1437 ((memq (char-after) '(?! ?+ ?-)) 1442 ((memq (char-after) '(?! ?+ ?-))
1438 (if (not (and (eq (char-after (1+ (point))) ?\n) 1443 (if (not (and (eq (char-after (1+ (point))) ?\n)
@@ -1483,8 +1488,8 @@ Only works for unified diffs."
1483 (after (string-to-number (or (match-string 4) "1")))) 1488 (after (string-to-number (or (match-string 4) "1"))))
1484 (forward-line) 1489 (forward-line)
1485 (while 1490 (while
1486 (case (char-after) 1491 (pcase (char-after)
1487 (?\s (decf before) (decf after) t) 1492 (?\s (cl-decf before) (cl-decf after) t)
1488 (?- 1493 (?-
1489 (if (and (looking-at diff-file-header-re) 1494 (if (and (looking-at diff-file-header-re)
1490 (zerop before) (zerop after)) 1495 (zerop before) (zerop after))
@@ -1494,15 +1499,15 @@ Only works for unified diffs."
1494 ;; line so that our code which doesn't count lines 1499 ;; line so that our code which doesn't count lines
1495 ;; will not get confused. 1500 ;; will not get confused.
1496 (progn (save-excursion (insert "\n")) nil) 1501 (progn (save-excursion (insert "\n")) nil)
1497 (decf before) t)) 1502 (cl-decf before) t))
1498 (?+ (decf after) t) 1503 (?+ (cl-decf after) t)
1499 (t 1504 (_
1500 (cond 1505 (cond
1501 ((and diff-valid-unified-empty-line 1506 ((and diff-valid-unified-empty-line
1502 ;; Not just (eolp) so we don't infloop at eob. 1507 ;; Not just (eolp) so we don't infloop at eob.
1503 (eq (char-after) ?\n) 1508 (eq (char-after) ?\n)
1504 (> before 0) (> after 0)) 1509 (> before 0) (> after 0))
1505 (decf before) (decf after) t) 1510 (cl-decf before) (cl-decf after) t)
1506 ((and (zerop before) (zerop after)) nil) 1511 ((and (zerop before) (zerop after)) nil)
1507 ((or (< before 0) (< after 0)) 1512 ((or (< before 0) (< after 0))
1508 (error (if (or (zerop before) (zerop after)) 1513 (error (if (or (zerop before) (zerop after))
@@ -1719,16 +1724,17 @@ the value of this variable when given an appropriate prefix argument).
1719 1724
1720With a prefix argument, REVERSE the hunk." 1725With a prefix argument, REVERSE the hunk."
1721 (interactive "P") 1726 (interactive "P")
1722 (destructuring-bind (buf line-offset pos old new &optional switched) 1727 (pcase-let ((`(,buf ,line-offset ,pos ,old ,new ,switched)
1723 ;; Sometimes we'd like to have the following behavior: if REVERSE go 1728 ;; Sometimes we'd like to have the following behavior: if
1724 ;; to the new file, otherwise go to the old. But that means that by 1729 ;; REVERSE go to the new file, otherwise go to the old.
1725 ;; default we use the old file, which is the opposite of the default 1730 ;; But that means that by default we use the old file, which is
1726 ;; for diff-goto-source, and is thus confusing. Also when you don't 1731 ;; the opposite of the default for diff-goto-source, and is thus
1727 ;; know about it it's pretty surprising. 1732 ;; confusing. Also when you don't know about it it's
1728 ;; TODO: make it possible to ask explicitly for this behavior. 1733 ;; pretty surprising.
1729 ;; 1734 ;; TODO: make it possible to ask explicitly for this behavior.
1730 ;; This is duplicated in diff-test-hunk. 1735 ;;
1731 (diff-find-source-location nil reverse) 1736 ;; This is duplicated in diff-test-hunk.
1737 (diff-find-source-location nil reverse)))
1732 (cond 1738 (cond
1733 ((null line-offset) 1739 ((null line-offset)
1734 (error "Can't find the text to patch")) 1740 (error "Can't find the text to patch"))
@@ -1771,8 +1777,8 @@ With a prefix argument, REVERSE the hunk."
1771 "See whether it's possible to apply the current hunk. 1777 "See whether it's possible to apply the current hunk.
1772With a prefix argument, try to REVERSE the hunk." 1778With a prefix argument, try to REVERSE the hunk."
1773 (interactive "P") 1779 (interactive "P")
1774 (destructuring-bind (buf line-offset pos src _dst &optional switched) 1780 (pcase-let ((`(,buf ,line-offset ,pos ,src ,_dst ,switched)
1775 (diff-find-source-location nil reverse) 1781 (diff-find-source-location nil reverse)))
1776 (set-window-point (display-buffer buf) (+ (car pos) (cdr src))) 1782 (set-window-point (display-buffer buf) (+ (car pos) (cdr src)))
1777 (diff-hunk-status-msg line-offset (diff-xor reverse switched) t))) 1783 (diff-hunk-status-msg line-offset (diff-xor reverse switched) t)))
1778 1784
@@ -1791,8 +1797,8 @@ then `diff-jump-to-old-file' is also set, for the next invocations."
1791 ;; This is a convenient detail when using smerge-diff. 1797 ;; This is a convenient detail when using smerge-diff.
1792 (if event (posn-set-point (event-end event))) 1798 (if event (posn-set-point (event-end event)))
1793 (let ((rev (not (save-excursion (beginning-of-line) (looking-at "[-<]"))))) 1799 (let ((rev (not (save-excursion (beginning-of-line) (looking-at "[-<]")))))
1794 (destructuring-bind (buf line-offset pos src _dst &optional switched) 1800 (pcase-let ((`(,buf ,line-offset ,pos ,src ,_dst ,switched)
1795 (diff-find-source-location other-file rev) 1801 (diff-find-source-location other-file rev)))
1796 (pop-to-buffer buf) 1802 (pop-to-buffer buf)
1797 (goto-char (+ (car pos) (cdr src))) 1803 (goto-char (+ (car pos) (cdr src)))
1798 (diff-hunk-status-msg line-offset (diff-xor rev switched) t)))) 1804 (diff-hunk-status-msg line-offset (diff-xor rev switched) t))))
@@ -1809,10 +1815,11 @@ For use in `add-log-current-defun-function'."
1809 (when (looking-at diff-hunk-header-re) 1815 (when (looking-at diff-hunk-header-re)
1810 (forward-line 1) 1816 (forward-line 1)
1811 (re-search-forward "^[^ ]" nil t)) 1817 (re-search-forward "^[^ ]" nil t))
1812 (destructuring-bind (&optional buf _line-offset pos src dst switched) 1818 (pcase-let ((`(,buf ,_line-offset ,pos ,src ,dst ,switched)
1813 ;; Use `noprompt' since this is used in which-func-mode and such. 1819 (ignore-errors ;Signals errors in place of prompting.
1814 (ignore-errors ;Signals errors in place of prompting. 1820 ;; Use `noprompt' since this is used in which-func-mode
1815 (diff-find-source-location nil nil 'noprompt)) 1821 ;; and such.
1822 (diff-find-source-location nil nil 'noprompt))))
1816 (when buf 1823 (when buf
1817 (beginning-of-line) 1824 (beginning-of-line)
1818 (or (when (memq (char-after) '(?< ?-)) 1825 (or (when (memq (char-after) '(?< ?-))
@@ -1835,7 +1842,7 @@ For use in `add-log-current-defun-function'."
1835 "Re-diff the current hunk, ignoring whitespace differences." 1842 "Re-diff the current hunk, ignoring whitespace differences."
1836 (interactive) 1843 (interactive)
1837 (let* ((char-offset (- (point) (diff-beginning-of-hunk t))) 1844 (let* ((char-offset (- (point) (diff-beginning-of-hunk t)))
1838 (opts (case (char-after) (?@ "-bu") (?* "-bc") (t "-b"))) 1845 (opts (pcase (char-after) (?@ "-bu") (?* "-bc") (_ "-b")))
1839 (line-nb (and (or (looking-at "[^0-9]+\\([0-9]+\\)") 1846 (line-nb (and (or (looking-at "[^0-9]+\\([0-9]+\\)")
1840 (error "Can't find line number")) 1847 (error "Can't find line number"))
1841 (string-to-number (match-string 1)))) 1848 (string-to-number (match-string 1))))
@@ -1857,13 +1864,13 @@ For use in `add-log-current-defun-function'."
1857 (let ((status 1864 (let ((status
1858 (call-process diff-command nil t nil 1865 (call-process diff-command nil t nil
1859 opts file1 file2))) 1866 opts file1 file2)))
1860 (case status 1867 (pcase status
1861 (0 nil) ;Nothing to reformat. 1868 (0 nil) ;Nothing to reformat.
1862 (1 (goto-char (point-min)) 1869 (1 (goto-char (point-min))
1863 ;; Remove the file-header. 1870 ;; Remove the file-header.
1864 (when (re-search-forward diff-hunk-header-re nil t) 1871 (when (re-search-forward diff-hunk-header-re nil t)
1865 (delete-region (point-min) (match-beginning 0)))) 1872 (delete-region (point-min) (match-beginning 0))))
1866 (t (goto-char (point-max)) 1873 (_ (goto-char (point-max))
1867 (unless (bolp) (insert "\n")) 1874 (unless (bolp) (insert "\n"))
1868 (insert hunk))) 1875 (insert hunk)))
1869 (setq hunk (buffer-string)) 1876 (setq hunk (buffer-string))
@@ -1942,14 +1949,14 @@ For use in `add-log-current-defun-function'."
1942 (remove-overlays beg end 'diff-mode 'fine) 1949 (remove-overlays beg end 'diff-mode 'fine)
1943 1950
1944 (goto-char beg) 1951 (goto-char beg)
1945 (case style 1952 (pcase style
1946 (unified 1953 (`unified
1947 (while (re-search-forward "^\\(?:-.*\n\\)+\\(\\)\\(?:\\+.*\n\\)+" 1954 (while (re-search-forward "^\\(?:-.*\n\\)+\\(\\)\\(?:\\+.*\n\\)+"
1948 end t) 1955 end t)
1949 (smerge-refine-subst (match-beginning 0) (match-end 1) 1956 (smerge-refine-subst (match-beginning 0) (match-end 1)
1950 (match-end 1) (match-end 0) 1957 (match-end 1) (match-end 0)
1951 nil 'diff-refine-preproc props-r props-a))) 1958 nil 'diff-refine-preproc props-r props-a)))
1952 (context 1959 (`context
1953 (let* ((middle (save-excursion (re-search-forward "^---"))) 1960 (let* ((middle (save-excursion (re-search-forward "^---")))
1954 (other middle)) 1961 (other middle))
1955 (while (re-search-forward "^\\(?:!.*\n\\)+" middle t) 1962 (while (re-search-forward "^\\(?:!.*\n\\)+" middle t)
@@ -1964,7 +1971,7 @@ For use in `add-log-current-defun-function'."
1964 'diff-refine-preproc 1971 'diff-refine-preproc
1965 (unless diff-use-changed-face props-r) 1972 (unless diff-use-changed-face props-r)
1966 (unless diff-use-changed-face props-a))))) 1973 (unless diff-use-changed-face props-a)))))
1967 (t ;; Normal diffs. 1974 (_ ;; Normal diffs.
1968 (let ((beg1 (1+ (point)))) 1975 (let ((beg1 (1+ (point))))
1969 (when (re-search-forward "^---.*\n" end t) 1976 (when (re-search-forward "^---.*\n" end t)
1970 ;; It's a combined add&remove, so there's something to do. 1977 ;; It's a combined add&remove, so there's something to do.
diff --git a/lisp/vc/diff.el b/lisp/vc/diff.el
index 6cfee52cbb5..b70b6cd919c 100644
--- a/lisp/vc/diff.el
+++ b/lisp/vc/diff.el
@@ -32,8 +32,6 @@
32 32
33(declare-function diff-setup-whitespace "diff-mode" ()) 33(declare-function diff-setup-whitespace "diff-mode" ())
34 34
35(eval-when-compile (require 'cl))
36
37(defgroup diff nil 35(defgroup diff nil
38 "Comparing files with `diff'." 36 "Comparing files with `diff'."
39 :group 'tools) 37 :group 'tools)
diff --git a/lisp/vc/log-edit.el b/lisp/vc/log-edit.el
index 5ecd5c44b2e..5ae311222ba 100644
--- a/lisp/vc/log-edit.el
+++ b/lisp/vc/log-edit.el
@@ -29,7 +29,6 @@
29 29
30;;; Code: 30;;; Code:
31 31
32(eval-when-compile (require 'cl))
33(require 'add-log) ; for all the ChangeLog goodies 32(require 'add-log) ; for all the ChangeLog goodies
34(require 'pcvs-util) 33(require 'pcvs-util)
35(require 'ring) 34(require 'ring)
diff --git a/lisp/vc/log-view.el b/lisp/vc/log-view.el
index d345a20a0f5..07526b4fba6 100644
--- a/lisp/vc/log-view.el
+++ b/lisp/vc/log-view.el
@@ -109,7 +109,6 @@
109 109
110;;; Code: 110;;; Code:
111 111
112(eval-when-compile (require 'cl))
113(require 'pcvs-util) 112(require 'pcvs-util)
114(autoload 'vc-find-revision "vc") 113(autoload 'vc-find-revision "vc")
115(autoload 'vc-diff-internal "vc") 114(autoload 'vc-diff-internal "vc")
diff --git a/lisp/vc/pcvs-defs.el b/lisp/vc/pcvs-defs.el
index ab45b313bd5..0f71b7b82e7 100644
--- a/lisp/vc/pcvs-defs.el
+++ b/lisp/vc/pcvs-defs.el
@@ -26,7 +26,6 @@
26 26
27;;; Code: 27;;; Code:
28 28
29(eval-when-compile (require 'cl))
30(require 'pcvs-util) 29(require 'pcvs-util)
31 30
32;;;; ------------------------------------------------------- 31;;;; -------------------------------------------------------
diff --git a/lisp/vc/pcvs-info.el b/lisp/vc/pcvs-info.el
index 4f8c114d721..36572640cfc 100644
--- a/lisp/vc/pcvs-info.el
+++ b/lisp/vc/pcvs-info.el
@@ -31,7 +31,7 @@
31 31
32;;; Code: 32;;; Code:
33 33
34(eval-when-compile (require 'cl)) 34(eval-when-compile (require 'cl-lib))
35(require 'pcvs-util) 35(require 'pcvs-util)
36;;(require 'pcvs-defs) 36;;(require 'pcvs-defs)
37 37
@@ -146,7 +146,7 @@ to confuse some users sometimes."
146 146
147;; Constructor: 147;; Constructor:
148 148
149(defstruct (cvs-fileinfo 149(cl-defstruct (cvs-fileinfo
150 (:constructor nil) 150 (:constructor nil)
151 (:copier nil) 151 (:copier nil)
152 (:constructor -cvs-create-fileinfo (type dir file full-log 152 (:constructor -cvs-create-fileinfo (type dir file full-log
@@ -274,10 +274,10 @@ to confuse some users sometimes."
274 (string= file (file-name-nondirectory file))) 274 (string= file (file-name-nondirectory file)))
275 (setq check 'type) (symbolp type) 275 (setq check 'type) (symbolp type)
276 (setq check 'consistency) 276 (setq check 'consistency)
277 (case type 277 (pcase type
278 (DIRCHANGE (and (null subtype) (string= "." file))) 278 (`DIRCHANGE (and (null subtype) (string= "." file)))
279 ((NEED-UPDATE ADDED MISSING DEAD MODIFIED MESSAGE UP-TO-DATE 279 ((or `NEED-UPDATE `ADDED `MISSING `DEAD `MODIFIED `MESSAGE
280 REMOVED NEED-MERGE CONFLICT UNKNOWN MESSAGE) 280 `UP-TO-DATE `REMOVED `NEED-MERGE `CONFLICT `UNKNOWN)
281 t))) 281 t)))
282 fi 282 fi
283 (error "Invalid :%s in cvs-fileinfo %s" check fi)))) 283 (error "Invalid :%s in cvs-fileinfo %s" check fi))))
@@ -325,9 +325,9 @@ FI-OR-TYPE can either be a symbol (a fileinfo-type) or a fileinfo."
325(defun cvs-add-face (str face &optional keymap &rest props) 325(defun cvs-add-face (str face &optional keymap &rest props)
326 (when keymap 326 (when keymap
327 (when (keymapp keymap) 327 (when (keymapp keymap)
328 (setq props (list* 'keymap keymap props))) 328 (setq props `(keymap ,keymap ,@props)))
329 (setq props (list* 'mouse-face 'highlight props))) 329 (setq props `(mouse-face highlight ,@props)))
330 (add-text-properties 0 (length str) (list* 'font-lock-face face props) str) 330 (add-text-properties 0 (length str) `(font-lock-face ,face ,@props) str)
331 str) 331 str)
332 332
333(defun cvs-fileinfo-pp (fileinfo) 333(defun cvs-fileinfo-pp (fileinfo)
@@ -337,15 +337,15 @@ For use by the cookie package."
337 (let ((type (cvs-fileinfo->type fileinfo)) 337 (let ((type (cvs-fileinfo->type fileinfo))
338 (subtype (cvs-fileinfo->subtype fileinfo))) 338 (subtype (cvs-fileinfo->subtype fileinfo)))
339 (insert 339 (insert
340 (case type 340 (pcase type
341 (DIRCHANGE (concat "In directory " 341 (`DIRCHANGE (concat "In directory "
342 (cvs-add-face (cvs-fileinfo->full-name fileinfo) 342 (cvs-add-face (cvs-fileinfo->full-name fileinfo)
343 'cvs-header t 'cvs-goal-column t) 343 'cvs-header t 'cvs-goal-column t)
344 ":")) 344 ":"))
345 (MESSAGE 345 (`MESSAGE
346 (cvs-add-face (format "Message: %s" (cvs-fileinfo->full-log fileinfo)) 346 (cvs-add-face (format "Message: %s" (cvs-fileinfo->full-log fileinfo))
347 'cvs-msg)) 347 'cvs-msg))
348 (t 348 (_
349 (let* ((status (if (cvs-fileinfo->marked fileinfo) 349 (let* ((status (if (cvs-fileinfo->marked fileinfo)
350 (cvs-add-face "*" 'cvs-marked) 350 (cvs-add-face "*" 'cvs-marked)
351 " ")) 351 " "))
@@ -354,10 +354,10 @@ For use by the cookie package."
354 (base (or (cvs-fileinfo->base-rev fileinfo) "")) 354 (base (or (cvs-fileinfo->base-rev fileinfo) ""))
355 (head (cvs-fileinfo->head-rev fileinfo)) 355 (head (cvs-fileinfo->head-rev fileinfo))
356 (type 356 (type
357 (let ((str (case type 357 (let ((str (pcase type
358 ;;(MOD-CONFLICT "Not Removed") 358 ;;(MOD-CONFLICT "Not Removed")
359 (DEAD "") 359 (`DEAD "")
360 (t (capitalize (symbol-name type))))) 360 (_ (capitalize (symbol-name type)))))
361 (face (let ((sym (intern 361 (face (let ((sym (intern
362 (concat "cvs-fi-" 362 (concat "cvs-fi-"
363 (downcase (symbol-name type)) 363 (downcase (symbol-name type))
diff --git a/lisp/vc/pcvs-parse.el b/lisp/vc/pcvs-parse.el
index a588c735ce7..dd448b9d480 100644
--- a/lisp/vc/pcvs-parse.el
+++ b/lisp/vc/pcvs-parse.el
@@ -32,8 +32,6 @@
32 32
33;;; Code: 33;;; Code:
34 34
35(eval-when-compile (require 'cl))
36
37(require 'pcvs-util) 35(require 'pcvs-util)
38(require 'pcvs-info) 36(require 'pcvs-info)
39 37
@@ -117,7 +115,7 @@ If RE matches, advance the point until the line after the match and
117then assign the variables as specified in MATCHES (via `setq')." 115then assign the variables as specified in MATCHES (via `setq')."
118 (cons 'cvs-do-match 116 (cons 'cvs-do-match
119 (cons re (mapcar (lambda (match) 117 (cons re (mapcar (lambda (match)
120 `(cons ',(first match) ,(second match))) 118 `(cons ',(car match) ,(cadr match)))
121 matches)))) 119 matches))))
122 120
123(defun cvs-do-match (re &rest matches) 121(defun cvs-do-match (re &rest matches)
@@ -150,8 +148,8 @@ Match RE and if successful, execute MATCHES."
150 (cvs-or 148 (cvs-or
151 (funcall parse-spec) 149 (funcall parse-spec)
152 150
153 (dolist (re cvs-parse-ignored-messages) 151 (cl-dolist (re cvs-parse-ignored-messages)
154 (when (cvs-match re) (return t))) 152 (when (cvs-match re) (cl-return t)))
155 153
156 ;; This is a parse error. Create a message-type fileinfo. 154 ;; This is a parse error. Create a message-type fileinfo.
157 (and 155 (and
@@ -221,7 +219,7 @@ The remaining KEYS are passed directly to `cvs-create-fileinfo'."
221 ;; ?: Unknown file. 219 ;; ?: Unknown file.
222 (let ((code (aref c 0))) 220 (let ((code (aref c 0)))
223 (cvs-parsed-fileinfo 221 (cvs-parsed-fileinfo
224 (case code 222 (pcase code
225 (?M 'MODIFIED) 223 (?M 'MODIFIED)
226 (?A 'ADDED) 224 (?A 'ADDED)
227 (?R 'REMOVED) 225 (?R 'REMOVED)
@@ -238,7 +236,7 @@ The remaining KEYS are passed directly to `cvs-create-fileinfo'."
238 (if (re-search-forward "^<<<<<<< " nil t) 236 (if (re-search-forward "^<<<<<<< " nil t)
239 'CONFLICT 'NEED-MERGE)))) 237 'CONFLICT 'NEED-MERGE))))
240 (?J 'NEED-MERGE) ;not supported by standard CVS 238 (?J 'NEED-MERGE) ;not supported by standard CVS
241 ((?U ?P) 239 ((or ?U ?P)
242 (if dont-change-disc 'NEED-UPDATE 240 (if dont-change-disc 'NEED-UPDATE
243 (cons 'UP-TO-DATE (if (eq code ?U) 'UPDATED 'PATCHED))))) 241 (cons 'UP-TO-DATE (if (eq code ?U) 'UPDATED 'PATCHED)))))
244 path 'trust))) 242 path 'trust)))
diff --git a/lisp/vc/pcvs-util.el b/lisp/vc/pcvs-util.el
index a3c525cb896..3d54bbd12a3 100644
--- a/lisp/vc/pcvs-util.el
+++ b/lisp/vc/pcvs-util.el
@@ -26,7 +26,7 @@
26 26
27;;; Code: 27;;; Code:
28 28
29(eval-when-compile (require 'cl)) 29(eval-when-compile (require 'cl-lib))
30 30
31;;;; 31;;;;
32;;;; list processing 32;;;; list processing
@@ -63,7 +63,7 @@
63 (while (and l (> n 1)) 63 (while (and l (> n 1))
64 (setcdr nl (list (pop l))) 64 (setcdr nl (list (pop l)))
65 (setq nl (cdr nl)) 65 (setq nl (cdr nl))
66 (decf n)) 66 (cl-decf n))
67 ret)))) 67 ret))))
68 68
69(defun cvs-partition (p l) 69(defun cvs-partition (p l)
@@ -130,10 +130,10 @@ If NOREUSE is non-nil, always return a new buffer."
130 (if noreuse (generate-new-buffer name) 130 (if noreuse (generate-new-buffer name)
131 (get-buffer-create name))) 131 (get-buffer-create name)))
132 (unless noreuse 132 (unless noreuse
133 (dolist (buf (buffer-list)) 133 (cl-dolist (buf (buffer-list))
134 (with-current-buffer buf 134 (with-current-buffer buf
135 (when (equal name list-buffers-directory) 135 (when (equal name list-buffers-directory)
136 (return buf))))) 136 (cl-return buf)))))
137 (with-current-buffer (create-file-buffer name) 137 (with-current-buffer (create-file-buffer name)
138 (setq list-buffers-directory name) 138 (setq list-buffers-directory name)
139 (current-buffer)))) 139 (current-buffer))))
@@ -195,10 +195,10 @@ arguments. If ARGS is not a list, no argument will be passed."
195;;;; (interactive <foo>) support function 195;;;; (interactive <foo>) support function
196;;;; 196;;;;
197 197
198(defstruct (cvs-qtypedesc 198(cl-defstruct (cvs-qtypedesc
199 (:constructor nil) (:copier nil) 199 (:constructor nil) (:copier nil)
200 (:constructor cvs-qtypedesc-create 200 (:constructor cvs-qtypedesc-create
201 (str2obj obj2str &optional complete hist-sym require))) 201 (str2obj obj2str &optional complete hist-sym require)))
202 str2obj 202 str2obj
203 obj2str 203 obj2str
204 hist-sym 204 hist-sym
@@ -231,10 +231,10 @@ arguments. If ARGS is not a list, no argument will be passed."
231;;;; Flags handling 231;;;; Flags handling
232;;;; 232;;;;
233 233
234(defstruct (cvs-flags 234(cl-defstruct (cvs-flags
235 (:constructor nil) 235 (:constructor nil)
236 (:constructor -cvs-flags-make 236 (:constructor -cvs-flags-make
237 (desc defaults &optional qtypedesc hist-sym))) 237 (desc defaults &optional qtypedesc hist-sym)))
238 defaults persist desc qtypedesc hist-sym) 238 defaults persist desc qtypedesc hist-sym)
239 239
240(defmacro cvs-flags-define (sym defaults 240(defmacro cvs-flags-define (sym defaults
diff --git a/lisp/vc/pcvs.el b/lisp/vc/pcvs.el
index 0508f45149a..659151a31e9 100644
--- a/lisp/vc/pcvs.el
+++ b/lisp/vc/pcvs.el
@@ -118,7 +118,7 @@
118 118
119;;; Code: 119;;; Code:
120 120
121(eval-when-compile (require 'cl)) 121(eval-when-compile (require 'cl-lib))
122(require 'ewoc) ;Ewoc was once cookie 122(require 'ewoc) ;Ewoc was once cookie
123(require 'pcvs-defs) 123(require 'pcvs-defs)
124(require 'pcvs-util) 124(require 'pcvs-util)
@@ -219,21 +219,21 @@
219(autoload 'cvs-status-get-tags "cvs-status") 219(autoload 'cvs-status-get-tags "cvs-status")
220(defun cvs-tags-list () 220(defun cvs-tags-list ()
221 "Return a list of acceptable tags, ready for completions." 221 "Return a list of acceptable tags, ready for completions."
222 (assert (cvs-buffer-p)) 222 (cl-assert (cvs-buffer-p))
223 (let ((marked (cvs-get-marked))) 223 (let ((marked (cvs-get-marked)))
224 (list* '("BASE") '("HEAD") 224 `(("BASE") ("HEAD")
225 (when marked 225 ,@(when marked
226 (with-temp-buffer 226 (with-temp-buffer
227 (process-file cvs-program 227 (process-file cvs-program
228 nil ;no input 228 nil ;no input
229 t ;output to current-buffer 229 t ;output to current-buffer
230 nil ;don't update display while running 230 nil ;don't update display while running
231 "status" 231 "status"
232 "-v" 232 "-v"
233 (cvs-fileinfo->full-name (car marked))) 233 (cvs-fileinfo->full-name (car marked)))
234 (goto-char (point-min)) 234 (goto-char (point-min))
235 (let ((tags (cvs-status-get-tags))) 235 (let ((tags (cvs-status-get-tags)))
236 (when (listp tags) tags))))))) 236 (when (listp tags) tags)))))))
237 237
238(defvar cvs-tag-history nil) 238(defvar cvs-tag-history nil)
239(defconst cvs-qtypedesc-tag 239(defconst cvs-qtypedesc-tag
@@ -426,16 +426,16 @@ If non-nil, NEW means to create a new buffer no matter what."
426 ;; look for another cvs buffer visiting the same directory 426 ;; look for another cvs buffer visiting the same directory
427 (save-excursion 427 (save-excursion
428 (unless new 428 (unless new
429 (dolist (buffer (cons (current-buffer) (buffer-list))) 429 (cl-dolist (buffer (cons (current-buffer) (buffer-list)))
430 (set-buffer buffer) 430 (set-buffer buffer)
431 (and (cvs-buffer-p) 431 (and (cvs-buffer-p)
432 (case cvs-reuse-cvs-buffer 432 (pcase cvs-reuse-cvs-buffer
433 (always t) 433 (`always t)
434 (subdir 434 (`subdir
435 (or (string-prefix-p default-directory dir) 435 (or (string-prefix-p default-directory dir)
436 (string-prefix-p dir default-directory))) 436 (string-prefix-p dir default-directory)))
437 (samedir (string= default-directory dir))) 437 (`samedir (string= default-directory dir)))
438 (return buffer))))) 438 (cl-return buffer)))))
439 ;; we really have to create a new buffer: 439 ;; we really have to create a new buffer:
440 ;; we temporarily bind cwd to "" to prevent 440 ;; we temporarily bind cwd to "" to prevent
441 ;; create-file-buffer from using directory info 441 ;; create-file-buffer from using directory info
@@ -478,7 +478,7 @@ If non-nil, NEW means to create a new buffer no matter what."
478 ;;(set-buffer buf) 478 ;;(set-buffer buf)
479 buffer)))))) 479 buffer))))))
480 480
481(defun* cvs-cmd-do (cmd dir flags fis new 481(cl-defun cvs-cmd-do (cmd dir flags fis new
482 &key cvsargs noexist dont-change-disc noshow) 482 &key cvsargs noexist dont-change-disc noshow)
483 (let* ((dir (file-name-as-directory 483 (let* ((dir (file-name-as-directory
484 (abbreviate-file-name (expand-file-name dir)))) 484 (abbreviate-file-name (expand-file-name dir))))
@@ -501,7 +501,7 @@ If non-nil, NEW means to create a new buffer no matter what."
501;; cvsbuf)))) 501;; cvsbuf))))
502 502
503(defun cvs-run-process (args fis postprocess &optional single-dir) 503(defun cvs-run-process (args fis postprocess &optional single-dir)
504 (assert (cvs-buffer-p cvs-buffer)) 504 (cl-assert (cvs-buffer-p cvs-buffer))
505 (save-current-buffer 505 (save-current-buffer
506 (let ((procbuf (current-buffer)) 506 (let ((procbuf (current-buffer))
507 (cvsbuf cvs-buffer) 507 (cvsbuf cvs-buffer)
@@ -521,9 +521,9 @@ If non-nil, NEW means to create a new buffer no matter what."
521 (let ((inhibit-read-only t)) 521 (let ((inhibit-read-only t))
522 (insert "pcl-cvs: descending directory " dir "\n")) 522 (insert "pcl-cvs: descending directory " dir "\n"))
523 ;; loop to find the same-dir-elems 523 ;; loop to find the same-dir-elems
524 (do* ((files () (cons (cvs-fileinfo->file fi) files)) 524 (cl-do* ((files () (cons (cvs-fileinfo->file fi) files))
525 (fis fis (cdr fis)) 525 (fis fis (cdr fis))
526 (fi (car fis) (car fis))) 526 (fi (car fis) (car fis)))
527 ((not (and fis (string= dir (cvs-fileinfo->dir fi)))) 527 ((not (and fis (string= dir (cvs-fileinfo->dir fi))))
528 (list dir files fis)))))) 528 (list dir files fis))))))
529 (dir (nth 0 dir+files+rest)) 529 (dir (nth 0 dir+files+rest))
@@ -813,7 +813,7 @@ TIN specifies an optional starting point."
813 (while (and tin (cvs-fileinfo< fi (ewoc-data tin))) 813 (while (and tin (cvs-fileinfo< fi (ewoc-data tin)))
814 (setq tin (ewoc-prev c tin))) 814 (setq tin (ewoc-prev c tin)))
815 (if (null tin) (ewoc-enter-first c fi) ;empty collection 815 (if (null tin) (ewoc-enter-first c fi) ;empty collection
816 (assert (not (cvs-fileinfo< fi (ewoc-data tin)))) 816 (cl-assert (not (cvs-fileinfo< fi (ewoc-data tin))))
817 (let ((next-tin (ewoc-next c tin))) 817 (let ((next-tin (ewoc-next c tin)))
818 (while (not (or (null next-tin) 818 (while (not (or (null next-tin)
819 (cvs-fileinfo< fi (ewoc-data next-tin)))) 819 (cvs-fileinfo< fi (ewoc-data next-tin))))
@@ -871,15 +871,15 @@ RM-MSGS if non-nil means remove messages."
871 (let* ((type (cvs-fileinfo->type fi)) 871 (let* ((type (cvs-fileinfo->type fi))
872 (subtype (cvs-fileinfo->subtype fi)) 872 (subtype (cvs-fileinfo->subtype fi))
873 (keep 873 (keep
874 (case type 874 (pcase type
875 ;; remove temp messages and keep the others 875 ;; remove temp messages and keep the others
876 (MESSAGE (not (or rm-msgs (eq subtype 'TEMP)))) 876 (`MESSAGE (not (or rm-msgs (eq subtype 'TEMP))))
877 ;; remove entries 877 ;; remove entries
878 (DEAD nil) 878 (`DEAD nil)
879 ;; handled also? 879 ;; handled also?
880 (UP-TO-DATE (not rm-handled)) 880 (`UP-TO-DATE (not rm-handled))
881 ;; keep the rest 881 ;; keep the rest
882 (t (not (run-hook-with-args-until-success 882 (_ (not (run-hook-with-args-until-success
883 'cvs-cleanup-functions fi)))))) 883 'cvs-cleanup-functions fi))))))
884 884
885 ;; mark dirs for removal 885 ;; mark dirs for removal
@@ -1389,7 +1389,7 @@ an empty list if it doesn't point to a file at all."
1389 fis)))) 1389 fis))))
1390 (nreverse fis))) 1390 (nreverse fis)))
1391 1391
1392(defun* cvs-mode-marked (filter &optional cmd 1392(cl-defun cvs-mode-marked (filter &optional cmd
1393 &key read-only one file noquery) 1393 &key read-only one file noquery)
1394 "Get the list of marked FIS. 1394 "Get the list of marked FIS.
1395CMD is used to determine whether to use the marks or not. 1395CMD is used to determine whether to use the marks or not.
@@ -1474,7 +1474,7 @@ The POSTPROC specified there (typically `log-edit') is then called,
1474 (let ((msg (buffer-substring-no-properties (point-min) (point-max)))) 1474 (let ((msg (buffer-substring-no-properties (point-min) (point-max))))
1475 (cvs-mode!) 1475 (cvs-mode!)
1476 ;;(pop-to-buffer cvs-buffer) 1476 ;;(pop-to-buffer cvs-buffer)
1477 (cvs-mode-do "commit" (list* "-m" msg flags) 'commit))) 1477 (cvs-mode-do "commit" `("-m" ,msg ,@flags) 'commit)))
1478 1478
1479 1479
1480;;;; Editing existing commit log messages. 1480;;;; Editing existing commit log messages.
@@ -1604,7 +1604,7 @@ With prefix argument, prompt for cvs flags."
1604 (or current-prefix-arg (not cvs-add-default-message))) 1604 (or current-prefix-arg (not cvs-add-default-message)))
1605 (read-from-minibuffer "Enter description: ") 1605 (read-from-minibuffer "Enter description: ")
1606 (or cvs-add-default-message ""))) 1606 (or cvs-add-default-message "")))
1607 (flags (list* "-m" msg flags)) 1607 (flags `("-m" ,msg ,@flags))
1608 (postproc 1608 (postproc
1609 ;; setup postprocessing for the directory entries 1609 ;; setup postprocessing for the directory entries
1610 (when dirs 1610 (when dirs
@@ -1845,7 +1845,7 @@ Signal an error if there is no backup file."
1845 (setq ret t))) 1845 (setq ret t)))
1846 ret))) 1846 ret)))
1847 1847
1848(defun* cvs-mode-run (cmd flags fis 1848(cl-defun cvs-mode-run (cmd flags fis
1849 &key (buf (cvs-temp-buffer)) 1849 &key (buf (cvs-temp-buffer))
1850 dont-change-disc cvsargs postproc) 1850 dont-change-disc cvsargs postproc)
1851 "Generic cvs-mode-<foo> function. 1851 "Generic cvs-mode-<foo> function.
@@ -1887,7 +1887,7 @@ POSTPROC is a list of expressions to be evaluated at the very end (after
1887 (cvs-run-process args fis postproc single-dir)))) 1887 (cvs-run-process args fis postproc single-dir))))
1888 1888
1889 1889
1890(defun* cvs-mode-do (cmd flags filter 1890(cl-defun cvs-mode-do (cmd flags filter
1891 &key show dont-change-disc cvsargs postproc) 1891 &key show dont-change-disc cvsargs postproc)
1892 "Generic cvs-mode-<foo> function. 1892 "Generic cvs-mode-<foo> function.
1893Executes `cvs CVSARGS CMD FLAGS' on the selected files. 1893Executes `cvs CVSARGS CMD FLAGS' on the selected files.
diff --git a/lisp/vc/smerge-mode.el b/lisp/vc/smerge-mode.el
index cf1cdabc80f..e6b63030fef 100644
--- a/lisp/vc/smerge-mode.el
+++ b/lisp/vc/smerge-mode.el
@@ -43,7 +43,7 @@
43 43
44;;; Code: 44;;; Code:
45 45
46(eval-when-compile (require 'cl)) 46(eval-when-compile (require 'cl-lib))
47(require 'diff-mode) ;For diff-auto-refine-mode. 47(require 'diff-mode) ;For diff-auto-refine-mode.
48(require 'newcomment) 48(require 'newcomment)
49 49
@@ -716,7 +716,7 @@ major modes. Uses `smerge-resolve-function' to do the actual work."
716 (while (or (not (match-end i)) 716 (while (or (not (match-end i))
717 (< (point) (match-beginning i)) 717 (< (point) (match-beginning i))
718 (>= (point) (match-end i))) 718 (>= (point) (match-end i)))
719 (decf i)) 719 (cl-decf i))
720 i)) 720 i))
721 721
722(defun smerge-keep-current () 722(defun smerge-keep-current ()
@@ -779,7 +779,7 @@ An error is raised if not inside a conflict."
779 (filename (or (match-string 1) "")) 779 (filename (or (match-string 1) ""))
780 780
781 (_ (re-search-forward smerge-end-re)) 781 (_ (re-search-forward smerge-end-re))
782 (_ (assert (< orig-point (match-end 0)))) 782 (_ (cl-assert (< orig-point (match-end 0))))
783 783
784 (other-end (match-beginning 0)) 784 (other-end (match-beginning 0))
785 (end (match-end 0)) 785 (end (match-end 0))
@@ -1073,12 +1073,12 @@ used to replace chars to try and eliminate some spurious differences."
1073 (forward-line 1) ;Skip hunk header. 1073 (forward-line 1) ;Skip hunk header.
1074 (and (re-search-forward "^[0-9]" nil 'move) ;Skip hunk body. 1074 (and (re-search-forward "^[0-9]" nil 'move) ;Skip hunk body.
1075 (goto-char (match-beginning 0)))) 1075 (goto-char (match-beginning 0))))
1076 ;; (assert (or (null last1) (< (overlay-start last1) end1))) 1076 ;; (cl-assert (or (null last1) (< (overlay-start last1) end1)))
1077 ;; (assert (or (null last2) (< (overlay-start last2) end2))) 1077 ;; (cl-assert (or (null last2) (< (overlay-start last2) end2)))
1078 (if smerge-refine-weight-hack 1078 (if smerge-refine-weight-hack
1079 (progn 1079 (progn
1080 ;; (assert (or (null last1) (<= (overlay-end last1) end1))) 1080 ;; (cl-assert (or (null last1) (<= (overlay-end last1) end1)))
1081 ;; (assert (or (null last2) (<= (overlay-end last2) end2))) 1081 ;; (cl-assert (or (null last2) (<= (overlay-end last2) end2)))
1082 ) 1082 )
1083 ;; smerge-refine-forward-function when calling in chopup may 1083 ;; smerge-refine-forward-function when calling in chopup may
1084 ;; have stopped because it bumped into EOB whereas in 1084 ;; have stopped because it bumped into EOB whereas in
@@ -1290,8 +1290,8 @@ with a \\[universal-argument] prefix, makes up a 3-way conflict."
1290 (progn (pop-mark) (mark)) 1290 (progn (pop-mark) (mark))
1291 (when current-prefix-arg (pop-mark) (mark)))) 1291 (when current-prefix-arg (pop-mark) (mark))))
1292 ;; Start from the end so as to avoid problems with pos-changes. 1292 ;; Start from the end so as to avoid problems with pos-changes.
1293 (destructuring-bind (pt1 pt2 pt3 &optional pt4) 1293 (pcase-let ((`(,pt1 ,pt2 ,pt3 ,pt4)
1294 (sort (list* pt1 pt2 pt3 (if pt4 (list pt4))) '>=) 1294 (sort `(,pt1 ,pt2 ,pt3 ,@(if pt4 (list pt4))) '>=)))
1295 (goto-char pt1) (beginning-of-line) 1295 (goto-char pt1) (beginning-of-line)
1296 (insert ">>>>>>> OTHER\n") 1296 (insert ">>>>>>> OTHER\n")
1297 (goto-char pt2) (beginning-of-line) 1297 (goto-char pt2) (beginning-of-line)