Skip to content

Commit 75506b3

Browse files
MorganJamesSmithjpgrayson
authored andcommitted
stgit.el: Fix various checkdoc warnings
There where 76 warnings before. Now there are 41.
1 parent ef65117 commit 75506b3

File tree

1 file changed

+50
-68
lines changed

1 file changed

+50
-68
lines changed

contrib/stgit.el

Lines changed: 50 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,7 @@
7979
(defvar-local stgit-buffer nil)
8080

8181
(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."
8483
(set-default symbol value)
8584
(dolist (buf (buffer-list))
8685
(with-current-buffer buf
@@ -146,17 +145,15 @@ shown."
146145
(defvar-local stgit-show-committed stgit-default-show-committed)
147146

148147
(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."
151149
:type 'number
152150
:group 'stgit
153151
:link '(variable-link stgit-default-show-committed)
154152
:link '(variable-link stgit-committed-count))
155153
(defvar-local stgit-committed-count stgit-default-committed-count)
156154

157155
(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.
160157
161158
Use \\<stgit-mode-map>\\[stgit-toggle-svn] to toggle this \
162159
setting in an already-started StGit buffer."
@@ -166,8 +163,8 @@ setting in an already-started StGit buffer."
166163
(defvar-local stgit-show-svn stgit-default-show-svn)
167164

168165
(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\"."
171168
:type 'boolean
172169
:group 'stgit
173170
:set 'stgit-set-default)
@@ -182,8 +179,7 @@ flag, which reduces performance."
182179
:set 'stgit-set-default)
183180

184181
(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.
187183
188184
It can be set to \='top (above all patches), \='center (show between
189185
applied and unapplied patches), and \='bottom (below all patches)."
@@ -368,8 +364,7 @@ See `stgit-mode' for commands available."
368364
(car (split-string cdup "\n")))))))
369365

370366
(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'."
373368
(when (and (fboundp 'git-find-status-buffer)
374369
(fboundp 'git-refresh-status))
375370
(let* ((top-dir (git-get-top-dir (or dir default-directory)))
@@ -413,8 +408,8 @@ A newline is appended."
413408
(insert (string-trim-right text " ") ?\n))
414409

415410
(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'."
418413
(if stgit-show-patch-names
419414
stgit-patch-line-format
420415
stgit-noname-patch-line-format))
@@ -468,8 +463,7 @@ Argument DIR is the repository path."
468463
(def-edebug-spec stgit-capture-output
469464
(form body))
470465
(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.
473467
Returns the result of the last form in BODY."
474468
(declare (debug ([&or stringp null] body))
475469
(indent 1))
@@ -506,7 +500,8 @@ Returns the result of the last form in BODY."
506500
"Set to non-nil to inhibit messages when running `stg' commands.
507501
See also `stgit-message'.")
508502
(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."
510505
(unless stgit-inhibit-messages
511506
(apply 'message format-spec args)))
512507

@@ -592,9 +587,8 @@ been advised to update the stgit status when necessary.")
592587
:empty nil)))))
593588

594589
(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'."
598592
(let ((point (point)))
599593
(and position (goto-char position))
600594
(prog1
@@ -606,8 +600,7 @@ default) that can be used to restore the point using
606600
(goto-char point))))
607601

608602
(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'."
611604
(cl-destructuring-bind (patch file line column) state
612605
(unless (and patch (cl-case (stgit-goto-patch patch file)
613606
((t) (move-to-column column) t)
@@ -636,8 +629,8 @@ Use `stgit-restore-window-state' to restore the state."
636629
transient-mark-mode))
637630

638631
(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'."
641634
(cl-destructuring-bind
642635
(buffer window-states buffer-state mark-state
643636
old-mark-active old-transient-mark-mode)
@@ -661,9 +654,7 @@ obtained from `stgit-get-window-state'."
661654
transient-mark-mode old-transient-mark-mode)))))
662655

663656
(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."
667658
(declare (indent 0) (debug (body)))
668659
(let ((state (make-symbol "state")))
669660
`(let ((,state (stgit-get-window-state))
@@ -672,8 +663,7 @@ where they were."
672663
(stgit-restore-window-state ,state))))
673664

674665
(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.
677667
678668
Cached data is stored in HASH, which must have been created
679669
using (make-hash-table :test \='equal)."
@@ -845,7 +835,7 @@ during the operation."
845835
(cdr code)))))
846836

847837
(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."
849839
(let ((code (assoc str '(("A" . add)
850840
("C" . copy)
851841
("D" . delete)
@@ -1014,8 +1004,8 @@ If NO-QUOTES is non-nil, do not enclose the result in double quotes."
10141004
'file-data file))))
10151005

10161006
(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'."
10191009
(if stgit-find-copies-harder "--find-copies-harder" "-C"))
10201010

10211011
(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."
10701060

10711061

10721062
(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."
10751064
(let* ((patchsym (stgit-patch->name patch))
10761065
(end (point-marker))
10771066
(args (list "-z" (stgit-find-copies-harder-diff-arg)))
@@ -1175,7 +1164,7 @@ expand if COLLAPSE is not nil."
11751164
(move-to-column (stgit-goal-column)))
11761165

11771166
(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.
11791168
11801169
See also `stgit-expand'."
11811170
(interactive (list (stgit-patches-marked-or-at-point t)))
@@ -1244,13 +1233,13 @@ file for (applied) copies and renames."
12441233
(t
12451234
(error "No patch or file on line"))))
12461235

1247-
(defun stgit-find-file-other-window (&optional this-rev)
1236+
(defun stgit-find-file-other-window (&optional revision)
12481237
"Open file at point in other window.
12491238
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."
12511240
(interactive "p")
12521241
(stgit-assert-mode)
1253-
(stgit-find-file t (> this-rev 1)))
1242+
(stgit-find-file t (> revision 1)))
12541243

12551244
(defun stgit-find-file-merge ()
12561245
"Open file at point and merge it using `smerge-ediff'."
@@ -1722,8 +1711,7 @@ See also \\[customize-group] for the \"stgit\" group."
17221711
(run-hooks 'stgit-mode-hook))
17231712

17241713
(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."
17271715
(mapc (lambda (sym)
17281716
(when (fboundp sym)
17291717
(eval `(defadvice ,sym (after stgit-update-stgit-for-buffer)
@@ -1732,8 +1720,7 @@ stgit buffers as the git status of files change."
17321720
funlist))
17331721

17341722
(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."
17371724
(mapc (lambda (arg)
17381725
(let ((feature (car arg))
17391726
(funlist (cdr arg)))
@@ -1748,9 +1735,8 @@ refresh the stgit buffers as the git status of files change."
17481735
(dired dired-delete-file))))
17491736

17501737
(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'.")
17541740

17551741
(defun stgit-run-pending-refreshs ()
17561742
"Run all pending stgit buffer updates as posted by `stgit-post-refresh'."
@@ -1796,8 +1782,7 @@ MODE specifies what to do:
17961782
stgit-pending-refresh-buffers)))))
17971783

17981784
(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.
18011786
18021787
MODE specifies how to update the buffer. See `stgit-post-refresh'
18031788
for the different values MODE can have."
@@ -1858,7 +1843,7 @@ allow historical commits; if nil, also allow work tree and index."
18581843

18591844
(defun stgit-patches-marked-or-at-point (&optional cause-error types)
18601845
"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.
18621847
18631848
TYPES controls which types of commits and patches can be returned.
18641849
If it is t, only allow stgit patches; if \='allow-committed, also
@@ -1989,7 +1974,7 @@ line of PATCHSYM and return :patch."
19891974
(defun stgit-reload-or-repair (repair)
19901975
"Update the contents of the StGit buffer (`stgit-reload').
19911976
1992-
With a prefix argument, repair the StGit metadata if the branch
1977+
With a prefix argument, REPAIR the StGit metadata if the branch
19931978
was modified with git commands (`stgit-repair')."
19941979
(interactive "P")
19951980
(stgit-assert-mode)
@@ -2088,8 +2073,8 @@ If OMIT-STGIT is not nil, filter out \"resf/heads/*.stgit\"."
20882073
result))))
20892074

20902075
(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."
20932078
(let ((output (with-output-to-string
20942079
(stgit-run-git-silent "config"
20952080
(format "branch.%s.stgit.parentbranch"
@@ -2134,8 +2119,9 @@ A negative COUNT will commit using `stgit-commit' instead."
21342119
(stgit-reload)))
21352120

21362121
(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."
21392125
(let ((old-point (point))
21402126
neighbour-file)
21412127
(and (zerop (forward-line 1))
@@ -2150,8 +2136,7 @@ previous file if point is at the last file within a patch."
21502136
neighbour-file))
21512137

21522138
(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.
21552140
21562141
Stage 1, the common ancestor, is \='ancestor.
21572142
Stage 2, HEAD, is \='head.
@@ -2170,8 +2155,7 @@ Stage 3, MERGE_HEAD, is \='merge-head."
21702155
stages))
21712156

21722157
(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."
21752159
(interactive)
21762160
(stgit-assert-mode)
21772161
(let* ((patched-file (or (stgit-patched-file-at-point)
@@ -2225,8 +2209,9 @@ working tree."
22252209
(stgit-goto-patch patch-name next-file))))
22262210

22272211
(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."
22302215
(interactive)
22312216
(stgit-assert-mode)
22322217
(let ((patched-file (stgit-patched-file-at-point)))
@@ -2348,8 +2333,7 @@ If ONLY-PATCHES is not nil, exclude index and work tree."
23482333
(not (next-single-property-change (point) 'patch-data)))
23492334

23502335
(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."
23532337
(let ((patch (stgit-patch-at-point)))
23542338
(cond (patch
23552339
(cl-case (stgit-patch->status patch)
@@ -2705,8 +2689,7 @@ that name (a symbol)."
27052689
(stgit-goto-patch new-patch))))
27062690

27072691
(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.
27102693
27112694
With a prefix argument, include a \"Signed-off-by:\" line at the
27122695
end of the patch.
@@ -2718,7 +2701,7 @@ This works just like running `stgit-new' followed by `stgit-refresh'."
27182701
(stgit-new add-sign t))
27192702

27202703
(defun stgit-create-patch-name (description)
2721-
"Create a patch name from a long description."
2704+
"Create a patch name from a long DESCRIPTION."
27222705
(let ((patch ""))
27232706
(while (> (length description) 0)
27242707
(cond ((string-match "\\`[a-zA-Z_-]+" description)
@@ -2767,8 +2750,7 @@ the work tree and index."
27672750
(stgit-reload)))))
27682751

27692752
(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'.
27722754
27732755
This is either the first unmarked patch at or after point, or one
27742756
of :top and :bottom if the point is after or before the applied
@@ -2787,8 +2769,8 @@ patches."
27872769
result)))
27882770

27892771
(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.
27922774
27932775
PATCHSYMS must not contain duplicate entries, unless
27942776
ALLOW-DUPLICATES is not nil."

0 commit comments

Comments
 (0)