@@ -159,8 +159,8 @@ flag, which reduces performance."
159159 " This variable controls where the \" Index\" and \" Work tree\"
160160will be shown on in the buffer.
161161
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)."
164164 :type '(radio (const :tag " above all patches (top)" top)
165165 (const :tag " between applied and unapplied patches (center)"
166166 center)
@@ -375,9 +375,7 @@ directory DIR or `default-directory'"
375375(defun stgit-insert-without-trailing-whitespace (text )
376376 " Insert TEXT in buffer using `insert' , without trailing whitespace.
377377A newline is appended."
378- (unless (string-match " \\ (.*?\\ ) *$" text)
379- (error ))
380- (insert (match-string 1 text) ?\n ))
378+ (insert (string-trim-right text " " ) ?\n ))
381379
382380(defun stgit-line-format ()
383381 " Return the current line format; one of
@@ -545,6 +543,8 @@ been advised to update the stgit status when necessary.")
545543 (ewoc-invalidate (car stgit-worktree-node) (cdr stgit-worktree-node))))
546544
547545(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.
548548 (setq index-node (cons ewoc (ewoc-enter-last ewoc
549549 (make-stgit-patch
550550 :status 'index
@@ -562,15 +562,15 @@ been advised to update the stgit status when necessary.")
562562 " Return `stgit-mode' position information at POSITION (point by
563563default) that can be used to restore the point using
564564`stgit-restore-position' ."
565- (let ((opoint (point )))
565+ (let ((point (point )))
566566 (and position (goto-char position))
567567 (prog1
568568 (list (stgit-patch-name-at-point)
569569 (let ((f (stgit-patched-file-at-point)))
570570 (and f (stgit-file->file f)))
571571 (line-number-at-pos )
572572 (current-column ))
573- (goto-char opoint ))))
573+ (goto-char point ))))
574574
575575(defun stgit-restore-position (state )
576576 " Move point to the position in STATE, as returned by
@@ -643,7 +643,7 @@ where they were."
643643reported by git svn.
644644
645645Cached data is stored in HASH, which must have been created
646- using (make-hash-table :test 'equal)."
646+ using (make-hash-table :test \= 'equal)."
647647 (let ((result (gethash sha1 hash t )))
648648 (when (eq result t )
649649 (let ((svn-rev (with-output-to-string
@@ -772,7 +772,7 @@ during the operation."
772772 (stgit-show-task-message description
773773 (let ((inhibit-read-only t ))
774774 (stgit-save-excursion
775- (ewoc-filter stgit-ewoc #' (lambda (x ) nil ))
775+ (ewoc-filter stgit-ewoc #' (lambda (_ ) nil ))
776776 (ewoc-set-hf stgit-ewoc
777777 (concat " Branch: "
778778 (propertize (stgit-current-branch)
@@ -1018,6 +1018,7 @@ If NO-QUOTES is non-nil, do not enclose the result in double quotes."
10181018 (let ((file
10191019 (cond ((looking-at
10201020 " \\ ([CR]\\ )\\ ([0-9]*\\ )\0 \\ ([^\0 ]*\\ )\0 \\ ([^\0 ]*\\ )\0 " )
1021+ ; ; TODO: Where does `patch' come from?
10211022 (let* ((patch-status (stgit-patch->status patch))
10221023 (file-subexp (if (eq patch-status 'unapplied )
10231024 3
@@ -1267,14 +1268,14 @@ With prefix argument, open a buffer with that revision of the file."
12671268 " Move cursor vertically down ARG lines."
12681269 (interactive " p" )
12691270 (stgit-assert-mode)
1270- (next -line arg)
1271+ (forward -line arg)
12711272 (move-to-column (stgit-goal-column)))
12721273
12731274(defun stgit-previous-line (&optional arg )
12741275 " Move cursor vertically up ARG lines."
12751276 (interactive " p" )
12761277 (stgit-assert-mode)
1277- (previous -line arg)
1278+ (forward -line ( - arg) )
12781279 (move-to-column (stgit-goal-column)))
12791280
12801281(defun stgit-next-patch (&optional arg )
@@ -1305,12 +1306,12 @@ With prefix argument, open a buffer with that revision of the file."
13051306 ((stgit-at-header-p)
13061307 (goto-char (point-min )))
13071308 (t
1308- (let ((opatch (stgit-patch-at-point)))
1309+ (let ((patch (stgit-patch-at-point)))
13091310 (when (stgit-patched-file-at-point)
13101311 (setq arg (1- arg)))
13111312 (ewoc-goto-prev stgit-ewoc arg)
13121313 (unless (zerop arg)
1313- (when (eq opatch (stgit-patch-at-point))
1314+ (when (eq patch (stgit-patch-at-point))
13141315 (goto-char (point-min )))))
13151316 (move-to-column (stgit-goal-column)))))
13161317
@@ -1326,16 +1327,16 @@ If ARG is non-nil, do this ARG times. If ARG is negative, move
13261327 (while (and (not (bobp ))
13271328 (> arg 0 ))
13281329 (stgit-previous-patch 1 )
1329- (let* ((opoint (point ))
1330+ (let* ((point (point ))
13301331 (patch (stgit-patch-at-point))
13311332 (status (and patch (stgit-patch->status patch))))
13321333 (while (and (not (bobp ))
13331334 (let* ((npatch (stgit-patch-at-point))
13341335 (nstatus (and npatch (stgit-patch->status npatch))))
13351336 (eq status nstatus)))
1336- (setq opoint (point ))
1337+ (setq point (point ))
13371338 (stgit-previous-patch 1 ))
1338- (goto-char opoint ))
1339+ (goto-char point ))
13391340 (setq arg (1- arg)))))
13401341
13411342(defun stgit-next-patch-group (&optional arg )
@@ -1768,7 +1769,7 @@ MODE specifies what to do:
17681769 (let ((elem (assq buffer stgit-pending-refresh-buffers)))
17691770 (if elem
17701771 ; ; if buffer is already present, update its mode if necessary
1771- (let ((omode (cdr elem)))
1772+ (let ((mode (cdr elem)))
17721773 (when (cl-case mode
17731774 (:index (eq mode :work ))
17741775 (:reload t ))
@@ -1808,14 +1809,19 @@ for the different values MODE can have."
18081809 (setq stgit-marked-patches '()))
18091810
18101811(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))
18121818
18131819(defun stgit-patch-name-at-point (&optional cause-error types )
18141820 " Return the patch name on the current line as a symbol.
18151821If CAUSE-ERROR is not nil, signal an error if none found.
18161822
18171823TYPES 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
18191825allow historical commits; if nil, also allow work tree and index."
18201826 (let ((patch (stgit-patch-at-point)))
18211827 (and patch
@@ -1839,7 +1845,7 @@ allow historical commits; if nil, also allow work tree and index."
18391845If CAUSE-ERRROR is not nil, signal an error if none found.
18401846
18411847TYPES 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
18431849allow historical commits; if nil, also allow work tree and index."
18441850 (if stgit-marked-patches
18451851 stgit-marked-patches
@@ -2131,9 +2137,9 @@ previous file if point is at the last file within a patch."
21312137 " Returns list of the merge stages that contain FILE, which
21322138must be an unmerged file.
21332139
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."
21372143 (let ((output (with-output-to-string
21382144 (stgit-run-git-silent " ls-files" " -u" " -z" " --"
21392145 (stgit-file->file file))))
@@ -2951,7 +2957,7 @@ If HARD is non-nil, use the --hard flag."
29512957 (stgit-assert-mode)
29522958 (let ((cmd (if redo " redo" " undo" )))
29532959 (stgit-capture-output nil
2954- (if arg
2960+ (if hard
29552961 (when (or (and (stgit-index-empty-p)
29562962 (stgit-work-tree-empty-p))
29572963 (y-or-n-p (format " Hard %s may overwrite index/work tree changes. Continue? "
0 commit comments