@@ -159,8 +159,8 @@ flag, which reduces performance."
159
159
" This variable controls where the \" Index\" and \" Work tree\"
160
160
will be shown on in the buffer.
161
161
162
- It can be set to 'top (above all patches), 'center (show between
163
- applied and unapplied patches), and 'bottom (below all patches)."
162
+ It can be set to \= 'top (above all patches), \= 'center (show between
163
+ applied and unapplied patches), and \= 'bottom (below all patches)."
164
164
:type '(radio (const :tag " above all patches (top)" top)
165
165
(const :tag " between applied and unapplied patches (center)"
166
166
center)
@@ -375,9 +375,7 @@ directory DIR or `default-directory'"
375
375
(defun stgit-insert-without-trailing-whitespace (text )
376
376
" Insert TEXT in buffer using `insert' , without trailing whitespace.
377
377
A newline is appended."
378
- (unless (string-match " \\ (.*?\\ ) *$" text)
379
- (error ))
380
- (insert (match-string 1 text) ?\n ))
378
+ (insert (string-trim-right text " " ) ?\n ))
381
379
382
380
(defun stgit-line-format ()
383
381
" Return the current line format; one of
@@ -545,6 +543,8 @@ been advised to update the stgit status when necessary.")
545
543
(ewoc-invalidate (car stgit-worktree-node) (cdr stgit-worktree-node))))
546
544
547
545
(defun stgit-run-series-insert-index (ewoc )
546
+ ; ; TODO: non-lexical stuff happening here (`index-node' and `worktree-node' ).
547
+ ; ; Fix this before enabling lexical binding.
548
548
(setq index-node (cons ewoc (ewoc-enter-last ewoc
549
549
(make-stgit-patch
550
550
:status 'index
@@ -562,15 +562,15 @@ been advised to update the stgit status when necessary.")
562
562
" Return `stgit-mode' position information at POSITION (point by
563
563
default) that can be used to restore the point using
564
564
`stgit-restore-position' ."
565
- (let ((opoint (point )))
565
+ (let ((point (point )))
566
566
(and position (goto-char position))
567
567
(prog1
568
568
(list (stgit-patch-name-at-point)
569
569
(let ((f (stgit-patched-file-at-point)))
570
570
(and f (stgit-file->file f)))
571
571
(line-number-at-pos )
572
572
(current-column ))
573
- (goto-char opoint ))))
573
+ (goto-char point ))))
574
574
575
575
(defun stgit-restore-position (state )
576
576
" Move point to the position in STATE, as returned by
@@ -643,7 +643,7 @@ where they were."
643
643
reported by git svn.
644
644
645
645
Cached data is stored in HASH, which must have been created
646
- using (make-hash-table :test 'equal)."
646
+ using (make-hash-table :test \= 'equal)."
647
647
(let ((result (gethash sha1 hash t )))
648
648
(when (eq result t )
649
649
(let ((svn-rev (with-output-to-string
@@ -772,7 +772,7 @@ during the operation."
772
772
(stgit-show-task-message description
773
773
(let ((inhibit-read-only t ))
774
774
(stgit-save-excursion
775
- (ewoc-filter stgit-ewoc #' (lambda (x ) nil ))
775
+ (ewoc-filter stgit-ewoc #' (lambda (_ ) nil ))
776
776
(ewoc-set-hf stgit-ewoc
777
777
(concat " Branch: "
778
778
(propertize (stgit-current-branch)
@@ -1018,6 +1018,7 @@ If NO-QUOTES is non-nil, do not enclose the result in double quotes."
1018
1018
(let ((file
1019
1019
(cond ((looking-at
1020
1020
" \\ ([CR]\\ )\\ ([0-9]*\\ )\0 \\ ([^\0 ]*\\ )\0 \\ ([^\0 ]*\\ )\0 " )
1021
+ ; ; TODO: Where does `patch' come from?
1021
1022
(let* ((patch-status (stgit-patch->status patch))
1022
1023
(file-subexp (if (eq patch-status 'unapplied )
1023
1024
3
@@ -1267,14 +1268,14 @@ With prefix argument, open a buffer with that revision of the file."
1267
1268
" Move cursor vertically down ARG lines."
1268
1269
(interactive " p" )
1269
1270
(stgit-assert-mode)
1270
- (next -line arg)
1271
+ (forward -line arg)
1271
1272
(move-to-column (stgit-goal-column)))
1272
1273
1273
1274
(defun stgit-previous-line (&optional arg )
1274
1275
" Move cursor vertically up ARG lines."
1275
1276
(interactive " p" )
1276
1277
(stgit-assert-mode)
1277
- (previous -line arg)
1278
+ (forward -line ( - arg) )
1278
1279
(move-to-column (stgit-goal-column)))
1279
1280
1280
1281
(defun stgit-next-patch (&optional arg )
@@ -1305,12 +1306,12 @@ With prefix argument, open a buffer with that revision of the file."
1305
1306
((stgit-at-header-p)
1306
1307
(goto-char (point-min )))
1307
1308
(t
1308
- (let ((opatch (stgit-patch-at-point)))
1309
+ (let ((patch (stgit-patch-at-point)))
1309
1310
(when (stgit-patched-file-at-point)
1310
1311
(setq arg (1- arg)))
1311
1312
(ewoc-goto-prev stgit-ewoc arg)
1312
1313
(unless (zerop arg)
1313
- (when (eq opatch (stgit-patch-at-point))
1314
+ (when (eq patch (stgit-patch-at-point))
1314
1315
(goto-char (point-min )))))
1315
1316
(move-to-column (stgit-goal-column)))))
1316
1317
@@ -1326,16 +1327,16 @@ If ARG is non-nil, do this ARG times. If ARG is negative, move
1326
1327
(while (and (not (bobp ))
1327
1328
(> arg 0 ))
1328
1329
(stgit-previous-patch 1 )
1329
- (let* ((opoint (point ))
1330
+ (let* ((point (point ))
1330
1331
(patch (stgit-patch-at-point))
1331
1332
(status (and patch (stgit-patch->status patch))))
1332
1333
(while (and (not (bobp ))
1333
1334
(let* ((npatch (stgit-patch-at-point))
1334
1335
(nstatus (and npatch (stgit-patch->status npatch))))
1335
1336
(eq status nstatus)))
1336
- (setq opoint (point ))
1337
+ (setq point (point ))
1337
1338
(stgit-previous-patch 1 ))
1338
- (goto-char opoint ))
1339
+ (goto-char point ))
1339
1340
(setq arg (1- arg)))))
1340
1341
1341
1342
(defun stgit-next-patch-group (&optional arg )
@@ -1768,7 +1769,7 @@ MODE specifies what to do:
1768
1769
(let ((elem (assq buffer stgit-pending-refresh-buffers)))
1769
1770
(if elem
1770
1771
; ; if buffer is already present, update its mode if necessary
1771
- (let ((omode (cdr elem)))
1772
+ (let ((mode (cdr elem)))
1772
1773
(when (cl-case mode
1773
1774
(:index (eq mode :work ))
1774
1775
(:reload t ))
@@ -1808,14 +1809,19 @@ for the different values MODE can have."
1808
1809
(setq stgit-marked-patches '()))
1809
1810
1810
1811
(defun stgit-patch-at-point (&optional cause-error )
1811
- (get-text-property (point ) 'patch-data ))
1812
+ " Return patch at point.
1813
+ If CAUSE-ERROR then throw an error when there is no patch."
1814
+ (let ((return (get-text-property (point ) 'patch-data )))
1815
+ (when (and cause-error (not return))
1816
+ (error " No patch at point " ))
1817
+ return))
1812
1818
1813
1819
(defun stgit-patch-name-at-point (&optional cause-error types )
1814
1820
" Return the patch name on the current line as a symbol.
1815
1821
If CAUSE-ERROR is not nil, signal an error if none found.
1816
1822
1817
1823
TYPES controls which types of commits and patches can be returned.
1818
- If it is t, only allow stgit patches; if 'allow-committed, also
1824
+ If it is t, only allow stgit patches; if \= 'allow-committed, also
1819
1825
allow historical commits; if nil, also allow work tree and index."
1820
1826
(let ((patch (stgit-patch-at-point)))
1821
1827
(and patch
@@ -1839,7 +1845,7 @@ allow historical commits; if nil, also allow work tree and index."
1839
1845
If CAUSE-ERRROR is not nil, signal an error if none found.
1840
1846
1841
1847
TYPES controls which types of commits and patches can be returned.
1842
- If it is t, only allow stgit patches; if 'allow-committed, also
1848
+ If it is t, only allow stgit patches; if \= 'allow-committed, also
1843
1849
allow historical commits; if nil, also allow work tree and index."
1844
1850
(if stgit-marked-patches
1845
1851
stgit-marked-patches
@@ -2131,9 +2137,9 @@ previous file if point is at the last file within a patch."
2131
2137
" Returns list of the merge stages that contain FILE, which
2132
2138
must be an unmerged file.
2133
2139
2134
- Stage 1, the common ancestor, is 'ancestor.
2135
- Stage 2, HEAD, is 'head.
2136
- Stage 3, MERGE_HEAD, is 'merge-head."
2140
+ Stage 1, the common ancestor, is \= 'ancestor.
2141
+ Stage 2, HEAD, is \= 'head.
2142
+ Stage 3, MERGE_HEAD, is \= 'merge-head."
2137
2143
(let ((output (with-output-to-string
2138
2144
(stgit-run-git-silent " ls-files" " -u" " -z" " --"
2139
2145
(stgit-file->file file))))
@@ -2951,7 +2957,7 @@ If HARD is non-nil, use the --hard flag."
2951
2957
(stgit-assert-mode)
2952
2958
(let ((cmd (if redo " redo" " undo" )))
2953
2959
(stgit-capture-output nil
2954
- (if arg
2960
+ (if hard
2955
2961
(when (or (and (stgit-index-empty-p)
2956
2962
(stgit-work-tree-empty-p))
2957
2963
(y-or-n-p (format " Hard %s may overwrite index/work tree changes. Continue? "
0 commit comments