52
52
(error " Emacs older than 22 is not supported by stgit.el " ))
53
53
54
54
(require 'git nil t )
55
- (require 'cl )
55
+ (require 'cl-lib )
56
56
(require 'comint )
57
57
(require 'dired )
58
58
(require 'ewoc )
@@ -318,7 +318,7 @@ See `stgit-mode' for commands available."
318
318
319
319
(defun stgit-assert-mode ()
320
320
" Signal an error if not in an StGit buffer."
321
- (assert (derived-mode-p 'stgit-mode ) nil " Not an StGit buffer" ))
321
+ (cl- assert (derived-mode-p 'stgit-mode ) nil " Not an StGit buffer" ))
322
322
323
323
(unless (fboundp 'git-get-top-dir )
324
324
(defun git-get-top-dir (dir )
@@ -361,13 +361,13 @@ directory DIR or `default-directory'"
361
361
(switch-to-buffer (or buffer
362
362
(create-stgit-buffer dir)))))
363
363
364
- (defstruct (stgit-patch
364
+ (cl- defstruct (stgit-patch
365
365
(:conc-name stgit-patch-> ))
366
366
status name desc empty files-ewoc)
367
367
368
368
(defun stgit-patch-display-name (patch )
369
369
(let ((name (stgit-patch->name patch)))
370
- (case name
370
+ (cl- case name
371
371
(:index " Index" )
372
372
(:work " Work Tree" )
373
373
(t (symbol-name name)))))
@@ -393,10 +393,10 @@ A newline is appended."
393
393
(face (cdr (assq status stgit-patch-status-face-alist)))
394
394
(fmt (stgit-line-format))
395
395
(spec (format-spec-make
396
- ?s (case status
397
- (' applied " +" )
398
- (' top " >" )
399
- (' unapplied " -" )
396
+ ?s (cl- case status
397
+ (applied " +" )
398
+ (top " >" )
399
+ (unapplied " -" )
400
400
(t " " ))
401
401
?m (if (memq name stgit-marked-patches)
402
402
" *" " " )
@@ -575,8 +575,8 @@ default) that can be used to restore the point using
575
575
(defun stgit-restore-position (state )
576
576
" Move point to the position in STATE, as returned by
577
577
`stgit-get-position' ."
578
- (destructuring-bind (patch file line column) state
579
- (unless (and patch (case (stgit-goto-patch patch file)
578
+ (cl- destructuring-bind (patch file line column) state
579
+ (unless (and patch (cl- case (stgit-goto-patch patch file)
580
580
((t ) (move-to-column column) t )
581
581
((:patch ) t )))
582
582
(goto-char (point-min ))
@@ -605,7 +605,7 @@ Use `stgit-restore-window-state' to restore the state."
605
605
(defun stgit-restore-window-state (state )
606
606
" Restore the state of the stgit buffer and windows in STATE, as
607
607
obtained from `stgit-get-window-state' ."
608
- (destructuring-bind
608
+ (cl- destructuring-bind
609
609
(buffer window-states buffer-state mark-state
610
610
old-mark-active old-transient-mark-mode)
611
611
state
@@ -753,7 +753,7 @@ using (make-hash-table :test 'equal)."
753
753
(stgit-run-series-insert-index ewoc))
754
754
(setq stgit-index-node index-node
755
755
stgit-worktree-node worktree-node
756
- stgit-marked-patches (intersection stgit-marked-patches
756
+ stgit-marked-patches (cl- intersection stgit-marked-patches
757
757
all-patchsyms)))))
758
758
759
759
(defun stgit-current-branch ()
@@ -894,7 +894,7 @@ Cf. `stgit-file-type-change-string'."
894
894
(propertize (format " %o " new-perm)
895
895
'face 'stgit-file-permission-face )))))))
896
896
897
- (defstruct (stgit-file
897
+ (cl- defstruct (stgit-file
898
898
(:conc-name stgit-file-> ))
899
899
old-perm new-perm copy-or-rename cr-score cr-from cr-to status file)
900
900
@@ -909,7 +909,7 @@ If NO-QUOTES is non-nil, do not enclose the result in double quotes."
909
909
(if (stgit-escape-file-name-p name)
910
910
(concat (if no-quotes " " " \" " )
911
911
(mapconcat (lambda (c )
912
- (case c
912
+ (cl- case c
913
913
(?\t " \\ t" )
914
914
(?\n " \\ n" )
915
915
(?\" " \\ \" " )
@@ -1137,11 +1137,11 @@ Non-interactively, operate on PATCHES, and collapse instead of
1137
1137
expand if COLLAPSE is not nil."
1138
1138
(interactive (list (stgit-patches-marked-or-at-point t )))
1139
1139
(stgit-assert-mode)
1140
- (let ((patches-diff (funcall (if collapse #'intersection #'set-difference )
1140
+ (let ((patches-diff (funcall (if collapse #'cl- intersection #'cl- set-difference )
1141
1141
patches stgit-expanded-patches)))
1142
1142
(setq stgit-expanded-patches
1143
1143
(if collapse
1144
- (set-difference stgit-expanded-patches patches-diff)
1144
+ (cl- set-difference stgit-expanded-patches patches-diff)
1145
1145
(append stgit-expanded-patches patches-diff)))
1146
1146
(stgit-show-task-message (concat (if collapse " Collapsing" " Expanding" )
1147
1147
" "
@@ -1180,7 +1180,7 @@ See also `stgit-expand'."
1180
1180
(set-marker end (point ))
1181
1181
(set-marker-insertion-type end t ))
1182
1182
1183
- (assert (string-match " /$" filename))
1183
+ (cl- assert (string-match " /$" filename))
1184
1184
; ; remove trailing "/"
1185
1185
(setf (stgit-file->file file) (substring filename 0 -1 ))
1186
1186
(ewoc-invalidate ewoc node)
@@ -1214,10 +1214,10 @@ With point on a file, open the associated file. Opens the target
1214
1214
file for (applied) copies and renames."
1215
1215
(interactive )
1216
1216
(stgit-assert-mode)
1217
- (case (get-text-property (point ) 'entry-type )
1218
- (' patch
1217
+ (cl- case (get-text-property (point ) 'entry-type )
1218
+ (patch
1219
1219
(stgit-select-patch))
1220
- (' file
1220
+ (file
1221
1221
(stgit-select-file))
1222
1222
(t
1223
1223
(error " No patch or file on line " ))))
@@ -1258,9 +1258,9 @@ With prefix argument, open a buffer with that revision of the file."
1258
1258
1259
1259
(defun stgit-goal-column ()
1260
1260
" Return goal column for the current line."
1261
- (case (get-text-property (point ) 'entry-type )
1262
- (' patch 2 )
1263
- (' file 4 )
1261
+ (cl- case (get-text-property (point ) 'entry-type )
1262
+ (patch 2 )
1263
+ (file 4 )
1264
1264
(t 0 )))
1265
1265
1266
1266
(defun stgit-next-line (&optional arg )
@@ -1769,7 +1769,7 @@ MODE specifies what to do:
1769
1769
(if elem
1770
1770
; ; if buffer is already present, update its mode if necessary
1771
1771
(let ((omode (cdr elem)))
1772
- (when (case mode
1772
+ (when (cl- case mode
1773
1773
(:index (eq mode :work ))
1774
1774
(:reload t ))
1775
1775
(setcdr elem mode)))
@@ -1820,7 +1820,7 @@ allow historical commits; if nil, also allow work tree and index."
1820
1820
(let ((patch (stgit-patch-at-point)))
1821
1821
(and patch
1822
1822
(memq (stgit-patch->status patch)
1823
- (case types
1823
+ (cl- case types
1824
1824
((nil ) nil )
1825
1825
((allow-committed) '(work index))
1826
1826
((t ) '(work index committed))
@@ -1904,7 +1904,7 @@ line of PATCHSYM and return :patch."
1904
1904
(stgit-assert-mode)
1905
1905
(let* ((node (ewoc-locate stgit-ewoc))
1906
1906
(patch (ewoc-data node)))
1907
- (case (stgit-patch->status patch)
1907
+ (cl- case (stgit-patch->status patch)
1908
1908
(work (error " Cannot mark the work tree " ))
1909
1909
(index (error " Cannot mark the index " ))
1910
1910
(committed (error " Cannot mark a committed patch " )))
@@ -2042,7 +2042,7 @@ If SKIP-CURRENT is not nil, do not include the current branch."
2042
2042
2043
2043
; ; Do not expand any (normal) patches in the new branch
2044
2044
(setq stgit-expanded-patches
2045
- (remove-if-not (lambda (p ) (memq p '(:work :index )))
2045
+ (cl- remove-if-not (lambda (p ) (memq p '(:work :index )))
2046
2046
stgit-expanded-patches))
2047
2047
2048
2048
(stgit-reload))))
@@ -2060,7 +2060,7 @@ If OMIT-STGIT is not nil, filter out \"resf/heads/*.stgit\"."
2060
2060
(substring s (match-end 0 ))
2061
2061
s))
2062
2062
(if omit-stgit
2063
- (delete-if (lambda (s )
2063
+ (cl- delete-if (lambda (s )
2064
2064
(string-match " ^refs/heads/.*\\ .stgit$" s))
2065
2065
result)
2066
2066
result))))
@@ -2212,7 +2212,7 @@ tree, or a single change in either."
2212
2212
(stgit-revert-file)
2213
2213
(let* ((patch-name (or (stgit-patch-name-at-point)
2214
2214
(error " No patch or file at point " )))
2215
- (patch-desc (case patch-name
2215
+ (patch-desc (cl- case patch-name
2216
2216
(:index " index" )
2217
2217
(:work " work tree" )
2218
2218
(t (error (substitute-command-keys
@@ -2309,7 +2309,7 @@ If ONLY-PATCHES is not nil, exclude index and work tree."
2309
2309
(stgit-assert-mode)
2310
2310
(let* ((patchsyms (stgit-patches-marked-or-at-point t t ))
2311
2311
(applied-syms (stgit-applied-patchsyms t ))
2312
- (unapplied (set-difference patchsyms applied-syms)))
2312
+ (unapplied (cl- set-difference patchsyms applied-syms)))
2313
2313
(stgit-capture-output nil
2314
2314
(apply 'stgit-run
2315
2315
(if unapplied " push" " pop" )
@@ -2330,7 +2330,7 @@ If ONLY-PATCHES is not nil, exclude index and work tree."
2330
2330
or :bottom."
2331
2331
(let ((patch (stgit-patch-at-point)))
2332
2332
(cond (patch
2333
- (case (stgit-patch->status patch)
2333
+ (cl- case (stgit-patch->status patch)
2334
2334
((work index) nil )
2335
2335
((committed) :bottom )
2336
2336
(t (stgit-patch->name patch))))
@@ -2349,7 +2349,7 @@ patches if used on a line after or before all patches."
2349
2349
(let ((patchsym (stgit-goto-target)))
2350
2350
(unless patchsym
2351
2351
(error " No patch to go to on this line " ))
2352
- (case patchsym
2352
+ (cl- case patchsym
2353
2353
(:top (stgit-push-or-pop-patches t t ))
2354
2354
(:bottom (stgit-push-or-pop-patches nil t ))
2355
2355
(t (stgit-capture-output nil
@@ -2380,14 +2380,14 @@ which stage to diff against in the case of unmerged files."
2380
2380
(let* ((space-arg (stgit-whitespace-diff-arg ignore-whitespace))
2381
2381
(patch-name (stgit-patch-name-at-point t ))
2382
2382
(entry-type (get-text-property (point ) 'entry-type ))
2383
- (diff-desc (case entry-type
2384
- (' file " diff" )
2385
- (' patch " patch" )
2383
+ (diff-desc (cl- case entry-type
2384
+ (file " diff" )
2385
+ (patch " patch" )
2386
2386
(t (error " No patch or file at point " )))))
2387
2387
(stgit-show-task-message (concat " Showing " diff-desc)
2388
2388
(stgit-capture-output (concat " *StGit " diff-desc " *" )
2389
- (case entry-type
2390
- (' file
2389
+ (cl- case entry-type
2390
+ (file
2391
2391
(let* ((patched-file (stgit-patched-file-at-point))
2392
2392
(patch-id (let ((id (stgit-id patch-name)))
2393
2393
(if (and (eq id :index )
@@ -2412,7 +2412,7 @@ which stage to diff against in the case of unmerged files."
2412
2412
(stgit-file->cr-to patched-file))
2413
2413
(list (stgit-file->file patched-file))))))
2414
2414
(apply 'stgit-run-git " diff" args)))
2415
- (' patch
2415
+ (patch
2416
2416
(let* ((patch-id (stgit-id patch-name)))
2417
2417
(if (or (eq patch-id :index ) (eq patch-id :work ))
2418
2418
(apply 'stgit-run-git " diff"
@@ -2629,7 +2629,7 @@ This works like `stgit-new' followed by `stgit-move'."
2629
2629
(interactive " P" )
2630
2630
(stgit-assert-mode)
2631
2631
(let ((patch (stgit-patch-at-point t )))
2632
- (case (stgit-patch->status patch)
2632
+ (cl- case (stgit-patch->status patch)
2633
2633
((index work) (stgit-new add-sign))
2634
2634
((applied top)
2635
2635
(unless (and (stgit-index-empty-p)
@@ -2909,7 +2909,7 @@ When the command has finished, reload the stgit buffer."
2909
2909
(let* ((patches (stgit-sort-patches
2910
2910
(stgit-patches-marked-or-at-point nil 'allow-committed )))
2911
2911
(patch-names (mapcar 'symbol-name patches))
2912
- (hyphens (find-if (lambda (s ) (string-match " ^-" s)) patch-names))
2912
+ (hyphens (cl- find-if (lambda (s ) (string-match " ^-" s)) patch-names))
2913
2913
(program (if git-mode stgit-git-program stgit-stg-program))
2914
2914
(defaultcmd (concat program
2915
2915
" "
0 commit comments