79
79
(defvar-local stgit-buffer nil )
80
80
81
81
(defun stgit-set-default (symbol value )
82
- " Set default value of SYMBOL to VALUE using `set-default' and
83
- reload all StGit buffers."
82
+ " Set default value of SYMBOL to VALUE and reload StGit buffers."
84
83
(set-default symbol value)
85
84
(dolist (buf (buffer-list ))
86
85
(with-current-buffer buf
@@ -146,17 +145,15 @@ shown."
146
145
(defvar-local stgit-show-committed stgit-default-show-committed)
147
146
148
147
(defcustom stgit-default-committed-count 5
149
- " The number of historical commits to show when `stgit-show-committed'
150
- is enabled."
148
+ " The number of historical commits to show when `stgit-show-committed' is enabled."
151
149
:type 'number
152
150
:group 'stgit
153
151
:link '(variable-link stgit-default-show-committed)
154
152
:link '(variable-link stgit-committed-count))
155
153
(defvar-local stgit-committed-count stgit-default-committed-count)
156
154
157
155
(defcustom stgit-default-show-svn t
158
- " Set to non-nil to by default show subversion information in a
159
- new stgit buffer.
156
+ " Set to non-nil to by default show subversion information in a new stgit buffer.
160
157
161
158
Use \\ <stgit-mode-map>\\ [stgit-toggle-svn] to toggle this \
162
159
setting in an already-started StGit buffer."
@@ -166,8 +163,8 @@ setting in an already-started StGit buffer."
166
163
(defvar-local stgit-show-svn stgit-default-show-svn)
167
164
168
165
(defcustom stgit-abbreviate-copies-and-renames t
169
- " If non-nil, abbreviate copies and renames as \" dir/{old -> new}/file \"
170
- instead of \" dir/old/file -> dir/new/file\" ."
166
+ " If non-nil, abbreviate copies and renames.
167
+ For example: \" dir/{old -> new}/file \" instead of \" dir/old/file -> dir/new/file\" ."
171
168
:type 'boolean
172
169
:group 'stgit
173
170
:set 'stgit-set-default )
@@ -182,8 +179,7 @@ flag, which reduces performance."
182
179
:set 'stgit-set-default )
183
180
184
181
(defcustom stgit-show-worktree-mode 'center
185
- " This variable controls where the \" Index\" and \" Work tree\"
186
- will be shown on in the buffer.
182
+ " Where the \" Index\" and \" Work tree\" will be shown in the buffer.
187
183
188
184
It can be set to \= 'top (above all patches), \= 'center (show between
189
185
applied and unapplied patches), and \= 'bottom (below all patches)."
@@ -368,8 +364,7 @@ See `stgit-mode' for commands available."
368
364
(car (split-string cdup " \n " )))))))
369
365
370
366
(defun stgit-refresh-git-status (&optional dir )
371
- " If it exists, refresh the `git-status' buffer belonging to
372
- directory DIR or `default-directory' "
367
+ " If it exists, refresh the `git-status' buffer for DIR or `default-directory' ."
373
368
(when (and (fboundp 'git-find-status-buffer )
374
369
(fboundp 'git-refresh-status ))
375
370
(let* ((top-dir (git-get-top-dir (or dir default-directory)))
@@ -413,8 +408,8 @@ A newline is appended."
413
408
(insert (string-trim-right text " " ) ?\n ))
414
409
415
410
(defun stgit-line-format ()
416
- " Return the current line format; one of
417
- `stgit-patch-line-format' and `stgit-noname-patch-line-format' "
411
+ " Return the current line format.
412
+ Will be either `stgit-patch-line-format' or `stgit-noname-patch-line-format' . "
418
413
(if stgit-show-patch-names
419
414
stgit-patch-line-format
420
415
stgit-noname-patch-line-format))
@@ -468,8 +463,7 @@ Argument DIR is the repository path."
468
463
(def-edebug-spec stgit-capture-output
469
464
(form body))
470
465
(defmacro stgit-capture-output (name &rest body )
471
- " Capture StGit output and, if there was any output, show it in a window
472
- at the end.
466
+ " Capture StGit output from BODY in buffer NAME and display it.
473
467
Returns the result of the last form in BODY."
474
468
(declare (debug ([&or stringp null] body))
475
469
(indent 1 ))
@@ -506,7 +500,8 @@ Returns the result of the last form in BODY."
506
500
" Set to non-nil to inhibit messages when running `stg' commands.
507
501
See also `stgit-message' ." )
508
502
(defun stgit-message (format-spec &rest args )
509
- " Call `message' on the arguments unless `stgit-inhibit-messages' is non-nil."
503
+ " Call `message' on the arguments unless `stgit-inhibit-messages' is non-nil.
504
+ See `message` for a description of FORMAT-SPEC and ARGS."
510
505
(unless stgit-inhibit-messages
511
506
(apply 'message format-spec args)))
512
507
@@ -592,9 +587,8 @@ been advised to update the stgit status when necessary.")
592
587
:empty nil )))))
593
588
594
589
(defun stgit-get-position (&optional position )
595
- " Return `stgit-mode' position information at POSITION (point by
596
- default) that can be used to restore the point using
597
- `stgit-restore-position' ."
590
+ " Return position information at POSITION or point that can be restored later.
591
+ Point restoration is done by `stgit-restore-position' ."
598
592
(let ((point (point )))
599
593
(and position (goto-char position))
600
594
(prog1
@@ -606,8 +600,7 @@ default) that can be used to restore the point using
606
600
(goto-char point))))
607
601
608
602
(defun stgit-restore-position (state )
609
- " Move point to the position in STATE, as returned by
610
- `stgit-get-position' ."
603
+ " Move point to the position in STATE, as returned by `stgit-get-position' ."
611
604
(cl-destructuring-bind (patch file line column) state
612
605
(unless (and patch (cl-case (stgit-goto-patch patch file)
613
606
((t ) (move-to-column column) t )
@@ -636,8 +629,8 @@ Use `stgit-restore-window-state' to restore the state."
636
629
transient-mark-mode))
637
630
638
631
(defun stgit-restore-window-state (state )
639
- " Restore the state of the stgit buffer and windows in STATE, as
640
- obtained from `stgit-get-window-state' ."
632
+ " Restore the state of the stgit buffer and windows in STATE.
633
+ State information is obtained from `stgit-get-window-state' ."
641
634
(cl-destructuring-bind
642
635
(buffer window-states buffer-state mark-state
643
636
old-mark-active old-transient-mark-mode)
@@ -661,9 +654,7 @@ obtained from `stgit-get-window-state'."
661
654
transient-mark-mode old-transient-mark-mode)))))
662
655
663
656
(defmacro stgit-save-excursion (&rest body )
664
- " Execute BODY and, for each window displaying the current
665
- buffer, move point and mark back to the file, patch, or line
666
- where they were."
657
+ " Save point relative position; execute BODY; restore point."
667
658
(declare (indent 0 ) (debug (body)))
668
659
(let ((state (make-symbol " state" )))
669
660
`(let ((, state (stgit-get-window-state))
@@ -672,8 +663,7 @@ where they were."
672
663
(stgit-restore-window-state , state ))))
673
664
674
665
(defun stgit-svn-find-rev (sha1 hash )
675
- " Return the subversion revision corresponding to SHA1 as
676
- reported by git svn.
666
+ " Return the subversion revision corresponding to SHA1 as reported by git svn.
677
667
678
668
Cached data is stored in HASH, which must have been created
679
669
using (make-hash-table :test \= 'equal)."
@@ -845,7 +835,7 @@ during the operation."
845
835
(cdr code)))))
846
836
847
837
(defun stgit-file-status-code (str &optional score )
848
- " Return stgit status code from git status string."
838
+ " Return stgit status code from git status string STR ."
849
839
(let ((code (assoc str '((" A" . add)
850
840
(" C" . copy)
851
841
(" D" . delete)
@@ -1014,8 +1004,8 @@ If NO-QUOTES is non-nil, do not enclose the result in double quotes."
1014
1004
'file-data file))))
1015
1005
1016
1006
(defun stgit-find-copies-harder-diff-arg ()
1017
- " Return the flag to use with `git-diff' depending on the
1018
- `stgit-find-copies-harder' flag ."
1007
+ " Return the flag to use with `git-diff' .
1008
+ Depends on the value of `stgit-find-copies-harder' ."
1019
1009
(if stgit-find-copies-harder " --find-copies-harder" " -C" ))
1020
1010
1021
1011
(defun stgit-insert-ls-files (args file-flag )
@@ -1070,8 +1060,7 @@ If NO-QUOTES is non-nil, do not enclose the result in double quotes."
1070
1060
1071
1061
1072
1062
(defun stgit-insert-patch-files (patch )
1073
- " Expand (show modification of) the patch PATCH after the line
1074
- at point."
1063
+ " Expand (show modification of) the patch PATCH after the line at point."
1075
1064
(let* ((patchsym (stgit-patch->name patch))
1076
1065
(end (point-marker ))
1077
1066
(args (list " -z" (stgit-find-copies-harder-diff-arg)))
@@ -1175,7 +1164,7 @@ expand if COLLAPSE is not nil."
1175
1164
(move-to-column (stgit-goal-column)))
1176
1165
1177
1166
(defun stgit-collapse (&optional patches )
1178
- " Hide the contents of marked patches , or the patch at point.
1167
+ " Hide the contents of marked PATCHES , or the patch at point.
1179
1168
1180
1169
See also `stgit-expand' ."
1181
1170
(interactive (list (stgit-patches-marked-or-at-point t )))
@@ -1244,13 +1233,13 @@ file for (applied) copies and renames."
1244
1233
(t
1245
1234
(error " No patch or file on line " ))))
1246
1235
1247
- (defun stgit-find-file-other-window (&optional this-rev )
1236
+ (defun stgit-find-file-other-window (&optional revision )
1248
1237
" Open file at point in other window.
1249
1238
1250
- With prefix argument, open a buffer with that revision of the file."
1239
+ With prefix argument, open a buffer with that REVISION of the file."
1251
1240
(interactive " p" )
1252
1241
(stgit-assert-mode)
1253
- (stgit-find-file t (> this-rev 1 )))
1242
+ (stgit-find-file t (> revision 1 )))
1254
1243
1255
1244
(defun stgit-find-file-merge ()
1256
1245
" Open file at point and merge it using `smerge-ediff' ."
@@ -1722,8 +1711,7 @@ See also \\[customize-group] for the \"stgit\" group."
1722
1711
(run-hooks 'stgit-mode-hook ))
1723
1712
1724
1713
(defun stgit-advise-funlist (funlist )
1725
- " Add advice to the functions in FUNLIST so we can refresh the
1726
- stgit buffers as the git status of files change."
1714
+ " Advise functions in FUNLIST to refresh stgit buffers."
1727
1715
(mapc (lambda (sym )
1728
1716
(when (fboundp sym)
1729
1717
(eval `(defadvice , sym (after stgit-update-stgit-for-buffer)
@@ -1732,8 +1720,7 @@ stgit buffers as the git status of files change."
1732
1720
funlist))
1733
1721
1734
1722
(defun stgit-advise ()
1735
- " Add advice to appropriate (non-stgit) git functions so we can
1736
- refresh the stgit buffers as the git status of files change."
1723
+ " Advise appropriate (non-stgit) git functions to refresh stgit buffers."
1737
1724
(mapc (lambda (arg )
1738
1725
(let ((feature (car arg))
1739
1726
(funlist (cdr arg)))
@@ -1748,9 +1735,8 @@ refresh the stgit buffers as the git status of files change."
1748
1735
(dired dired-delete-file))))
1749
1736
1750
1737
(defvar stgit-pending-refresh-buffers nil
1751
- " Alist of (`buffer' . `mode' ) of buffers that need to be
1752
- refreshed. See `stgit-post-refresh' for the different values of
1753
- `mode' ." )
1738
+ " Alist of (`buffer' . `mode' ) of buffers that need to be refreshed.
1739
+ See `stgit-post-refresh' for the different values of `mode' ." )
1754
1740
1755
1741
(defun stgit-run-pending-refreshs ()
1756
1742
" Run all pending stgit buffer updates as posted by `stgit-post-refresh' ."
@@ -1796,8 +1782,7 @@ MODE specifies what to do:
1796
1782
stgit-pending-refresh-buffers)))))
1797
1783
1798
1784
(defun stgit-update-stgit-for-buffer (&optional mode )
1799
- " When Emacs becomes idle, update the status in any `stgit-mode'
1800
- buffer that shows the status of the current buffer.
1785
+ " When Emacs becomes idle, update the status in any `stgit-mode' buffers.
1801
1786
1802
1787
MODE specifies how to update the buffer. See `stgit-post-refresh'
1803
1788
for the different values MODE can have."
@@ -1858,7 +1843,7 @@ allow historical commits; if nil, also allow work tree and index."
1858
1843
1859
1844
(defun stgit-patches-marked-or-at-point (&optional cause-error types )
1860
1845
" Return the symbols of the marked patches, or the patch on the current line.
1861
- If CAUSE-ERRROR is not nil, signal an error if none found.
1846
+ If CAUSE-ERROR is not nil, signal an error if none found.
1862
1847
1863
1848
TYPES controls which types of commits and patches can be returned.
1864
1849
If it is t, only allow stgit patches; if \= 'allow-committed, also
@@ -1989,7 +1974,7 @@ line of PATCHSYM and return :patch."
1989
1974
(defun stgit-reload-or-repair (repair )
1990
1975
" Update the contents of the StGit buffer (`stgit-reload' ).
1991
1976
1992
- With a prefix argument, repair the StGit metadata if the branch
1977
+ With a prefix argument, REPAIR the StGit metadata if the branch
1993
1978
was modified with git commands (`stgit-repair' )."
1994
1979
(interactive " P" )
1995
1980
(stgit-assert-mode)
@@ -2088,8 +2073,8 @@ If OMIT-STGIT is not nil, filter out \"resf/heads/*.stgit\"."
2088
2073
result))))
2089
2074
2090
2075
(defun stgit-parent-branch ()
2091
- " Return the parent branch of the current stg branch as per
2092
- git-config setting branch.<branch>.stgit.parentbranch."
2076
+ " Return the parent branch of the current stg branch.
2077
+ It is determed as per git-config setting branch.<branch>.stgit.parentbranch."
2093
2078
(let ((output (with-output-to-string
2094
2079
(stgit-run-git-silent " config"
2095
2080
(format " branch.%s .stgit.parentbranch "
@@ -2134,8 +2119,9 @@ A negative COUNT will commit using `stgit-commit' instead."
2134
2119
(stgit-reload)))
2135
2120
2136
2121
(defun stgit-neighbour-file ()
2137
- " Return the file name of the next file after point, or the
2138
- previous file if point is at the last file within a patch."
2122
+ " Return the file name of the file at point.
2123
+ It will be the file after point, or the previous file if point is at the
2124
+ last file within a patch."
2139
2125
(let ((old-point (point ))
2140
2126
neighbour-file)
2141
2127
(and (zerop (forward-line 1 ))
@@ -2150,8 +2136,7 @@ previous file if point is at the last file within a patch."
2150
2136
neighbour-file))
2151
2137
2152
2138
(defun stgit-unmerged-file-stages (file )
2153
- " Returns list of the merge stages that contain FILE, which
2154
- must be an unmerged file.
2139
+ " Returns list of merge stages that contain FILE, which must be an unmerged file.
2155
2140
2156
2141
Stage 1, the common ancestor, is \= 'ancestor.
2157
2142
Stage 2, HEAD, is \= 'head.
@@ -2170,8 +2155,7 @@ Stage 3, MERGE_HEAD, is \='merge-head."
2170
2155
stages))
2171
2156
2172
2157
(defun stgit-revert-file ()
2173
- " Revert the file at point, which must be in the index or the
2174
- working tree."
2158
+ " Revert the file at point, which must be in the index or the working tree."
2175
2159
(interactive )
2176
2160
(stgit-assert-mode)
2177
2161
(let* ((patched-file (or (stgit-patched-file-at-point)
@@ -2225,8 +2209,9 @@ working tree."
2225
2209
(stgit-goto-patch patch-name next-file))))
2226
2210
2227
2211
(defun stgit-revert ()
2228
- " Revert the change at point, which must be the index, the work
2229
- tree, or a single change in either."
2212
+ " Revert the change at point.
2213
+ The change must be in the index, the work tree, or a single change in
2214
+ either."
2230
2215
(interactive )
2231
2216
(stgit-assert-mode)
2232
2217
(let ((patched-file (stgit-patched-file-at-point)))
@@ -2348,8 +2333,7 @@ If ONLY-PATCHES is not nil, exclude index and work tree."
2348
2333
(not (next-single-property-change (point ) 'patch-data )))
2349
2334
2350
2335
(defun stgit-goto-target ()
2351
- " Return the goto target at point: a patchsym, :top,
2352
- or :bottom."
2336
+ " Return the goto target at point: a patchsym, :top, or :bottom."
2353
2337
(let ((patch (stgit-patch-at-point)))
2354
2338
(cond (patch
2355
2339
(cl-case (stgit-patch->status patch)
@@ -2705,8 +2689,7 @@ that name (a symbol)."
2705
2689
(stgit-goto-patch new-patch))))
2706
2690
2707
2691
(defun stgit-new-and-refresh (add-sign )
2708
- " Create a new patch based on the current changes, asking for a
2709
- commit message.
2692
+ " Create a new patch based on the current changes, asking for a commit message.
2710
2693
2711
2694
With a prefix argument, include a \" Signed-off-by:\" line at the
2712
2695
end of the patch.
@@ -2718,7 +2701,7 @@ This works just like running `stgit-new' followed by `stgit-refresh'."
2718
2701
(stgit-new add-sign t ))
2719
2702
2720
2703
(defun stgit-create-patch-name (description )
2721
- " Create a patch name from a long description ."
2704
+ " Create a patch name from a long DESCRIPTION ."
2722
2705
(let ((patch " " ))
2723
2706
(while (> (length description) 0 )
2724
2707
(cond ((string-match " \\ `[a-zA-Z_-]+" description)
@@ -2767,8 +2750,7 @@ the work tree and index."
2767
2750
(stgit-reload)))))
2768
2751
2769
2752
(defun stgit-move-patches-target ()
2770
- " Return the patchsym indicating a target patch for
2771
- `stgit-move-patches' .
2753
+ " Return the patchsym indicating a target patch for `stgit-move-patches' .
2772
2754
2773
2755
This is either the first unmarked patch at or after point, or one
2774
2756
of :top and :bottom if the point is after or before the applied
@@ -2787,8 +2769,8 @@ patches."
2787
2769
result)))
2788
2770
2789
2771
(defun stgit-sort-patches (patchsyms &optional allow-duplicates )
2790
- " Returns the list of patches in PATCHSYMS sorted according to
2791
- their position in the patch series, bottommost first.
2772
+ " Returns a list of patches in PATCHSYMS sorted by patch series position.
2773
+ The bottommost position is first.
2792
2774
2793
2775
PATCHSYMS must not contain duplicate entries, unless
2794
2776
ALLOW-DUPLICATES is not nil."
0 commit comments