Skip to content

Commit dd441eb

Browse files
committed
Tidy: Docstrings, indentation
1 parent 8da7a8e commit dd441eb

File tree

2 files changed

+34
-19
lines changed

2 files changed

+34
-19
lines changed

magit-todos.el

Lines changed: 27 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ This should be set automatically by customizing
115115
(defvar-local magit-todos-active-scan nil
116116
"The current scan's process.
117117
Used to avoid running multiple simultaneous scans for a
118-
magit-status buffer.")
118+
`magit-status' buffer.")
119119

120120
(defvar magit-todos-section-map
121121
(let ((map (make-sparse-keymap)))
@@ -167,7 +167,7 @@ A time value as returned by `current-time'.")
167167
(defcustom magit-todos-scanner nil
168168
"File scanning method.
169169
\"Automatic\" will attempt to use rg, ag, git-grep, and
170-
find-grep, in that order. "
170+
find-grep, in that order."
171171
:type '(choice (const :tag "Automatic" nil)
172172
(function :tag "Custom function"))
173173
:set (lambda (option value)
@@ -444,13 +444,13 @@ Only necessary when option `magit-todos-update' is nil."
444444
(magit-todos-update))
445445

446446
(defun magit-todos-branch-list-set-commit (ref)
447-
"Set commit ref used in branch to-do list."
447+
"Set commit REF used in branch to-do list."
448448
(interactive (list (completing-read "Refname: " (magit-list-refnames))))
449449
(setq-local magit-todos-branch-list-merge-base-ref ref)
450450
(magit-todos-update))
451451

452452
(cl-defun magit-todos-jump-to-item (&key peek (item (oref (magit-current-section) value)))
453-
"Show current item.
453+
"Show current ITEM.
454454
If PEEK is non-nil, keep focus in status buffer window."
455455
(interactive)
456456
(let* ((status-window (selected-window))
@@ -494,7 +494,8 @@ If PEEK is non-nil, keep focus in status buffer window."
494494
;;;###autoload
495495
(defun magit-todos-list (&optional directory)
496496
"Show to-do list of the current Git repository in a buffer.
497-
With prefix, prompt for repository."
497+
With prefix, prompt for repository. Use repository in DIRECTORY,
498+
or `default-directory' if nil."
498499
;; Mostly copied from `magit-status'
499500
(interactive
500501
(let ((magit--refresh-cache (list (cons 0 0))))
@@ -547,13 +548,13 @@ Type \\[magit-diff-show-or-scroll-up] to peek at the item at point."
547548
"Return end position of section matching CONDITION, or nil.
548549
CONDITION may be one accepted by `magit-section-match', or `top'
549550
or `bottom', which are handled specially."
550-
(cl-labels ((find-section
551-
(condition) (save-excursion
552-
(goto-char (point-min))
553-
(ignore-errors
554-
(cl-loop until (magit-section-match condition)
555-
do (magit-section-forward)
556-
finally return (magit-current-section))))))
551+
(cl-labels ((find-section (condition)
552+
(save-excursion
553+
(goto-char (point-min))
554+
(ignore-errors
555+
(cl-loop until (magit-section-match condition)
556+
do (magit-section-forward)
557+
finally return (magit-current-section))))))
557558
(save-excursion
558559
(goto-char (point-min))
559560
(pcase condition
@@ -637,7 +638,13 @@ buffer for RESULTS-REGEXP."
637638

638639
(cl-defun magit-todos--git-diff-callback (&key magit-status-buffer results-regexp search-regexp-elisp process heading
639640
exclude-globs &allow-other-keys)
640-
"Callback for git diff scanner output."
641+
"Callback for git diff scanner output.
642+
Insert into MAGIT-STATUS-BUFFER. RESULTS-REGEXP matches a result
643+
on each line. SEARCH-REGEXP-ELISP finds the next hunk of
644+
results. PROCESS is the \"git diff\" process object.
645+
`magit-todos-section-heading' is bound to HEADING when inserting
646+
items. EXCLUDE-GLOBS is a list of glob patterns matching
647+
filenames to be excluded."
641648
;; NOTE: Doesn't handle newlines in filenames or diff.mnemonicPrefix.
642649
(cl-macrolet ((next-diff () `(re-search-forward (rx bol "diff --git ") nil t))
643650
(next-filename () `(when (re-search-forward (rx bol "+++ b/" (group (1+ nonl))) nil t)
@@ -1002,6 +1009,7 @@ advance to the next line."
10021009

10031010
(defun magit-todos--fontify-like-in-org-mode (s &optional odd-levels)
10041011
"Fontify string S like in Org-mode.
1012+
Bind `org-odd-levels-only' to ODD-LEVELS.
10051013
10061014
`org-fontify-like-in-org-mode' is a very, very slow function
10071015
because it creates a new temporary buffer and runs `org-mode' for
@@ -1029,12 +1037,12 @@ useful with absolute paths)."
10291037
(car (f-split (magit-todos-item-filename item))))
10301038

10311039
(cl-defun magit-todos--async-start-process (name &key command finish-func)
1032-
"Start the executable PROGRAM asynchronously. See `async-start'.
1040+
"Start the executable COMMAND asynchronously. See `async-start'.
10331041
PROGRAM is passed PROGRAM-ARGS, calling FINISH-FUNC with the
10341042
process object when done. If FINISH-FUNC is nil, the future
10351043
object will return the process object when the program is
10361044
finished. Set DEFAULT-DIRECTORY to change PROGRAM's current
1037-
working directory.
1045+
working directory. Process is named NAME.
10381046
10391047
This is a copy of `async-start-process' that does not override
10401048
`process-connection-type'. It also uses keyword arguments."
@@ -1054,7 +1062,7 @@ This is a copy of `async-start-process' that does not override
10541062
proc)))
10551063

10561064
(defun magit-todos--async-when-done (proc &optional _change)
1057-
"Process sentinel used to retrieve the value from the child process.
1065+
"Process sentinel used to retrieve the value from the child PROC.
10581066
10591067
This is a copy of `async-when-done' that does not raise an error
10601068
if the process's buffer has already been deleted."
@@ -1090,7 +1098,7 @@ if the process's buffer has already been deleted."
10901098
(backward-sexp)
10911099
(async-handle-result async-callback (read (current-buffer))
10921100
(current-buffer)))
1093-
(error "magit-todos--async-when-done: process %S failed with exit code %d. Output:%S"
1101+
(error "magit-todos--async-when-done: Process %S failed with exit code %d. Output:%S"
10941102
(process-name proc) (process-exit-status proc) (buffer-string)))))))
10951103

10961104
;;;;; Formatters
@@ -1121,7 +1129,7 @@ if the process's buffer has already been deleted."
11211129
(defun magit-todos--sort-by-keyword (a b)
11221130
"Return non-nil if A's keyword is before B's in `magit-todos-keywords-list'."
11231131
(cl-flet ((keyword-index (keyword)
1124-
(or (-elem-index keyword magit-todos-keywords-list) 0)))
1132+
(or (-elem-index keyword magit-todos-keywords-list) 0)))
11251133
(< (keyword-index (magit-todos-item-keyword a))
11261134
(keyword-index (magit-todos-item-keyword b)))))
11271135

@@ -1486,7 +1494,7 @@ When SYNC is non-nil, match items are returned."
14861494
;; Helm or Ivy to be installed; it is only called after one of them is loaded.
14871495

14881496
(declare-function helm-make-source "ext:helm-source")
1489-
(declare-function helm "ext:helm")
1497+
(declare-function helm "ext:helm-core")
14901498

14911499
(with-eval-after-load 'helm
14921500
(defvar helm-magit-todos-source

makem.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,12 @@ Source files are automatically discovered from git, or may be
112112
specified with options. Package dependencies are discovered from
113113
"Package-Requires" headers in source files, from -pkg.el files, and
114114
from a Cask file.
115+
116+
Checkdoc's spell checker may not recognize some words, causing the
117+
`lint-checkdoc' rule to fail. Custom words can be added in file-local
118+
or directory-local variables using the variable
119+
`ispell-buffer-session-localwords', which should be set to a list of
120+
strings.
115121
EOF
116122
}
117123
@@ -177,6 +183,7 @@ function elisp-checkdoc-file {
177183
(setq makem-checkdoc-errors-p t)
178184
;; Return nil because we *are* generating a buffered list of errors.
179185
nil))))
186+
(put 'ispell-buffer-session-localwords 'safe-local-variable #'list-of-strings-p)
180187
(mapcar #'checkdoc-file files)
181188
(when makem-checkdoc-errors-p
182189
(kill-emacs 1))))

0 commit comments

Comments
 (0)