When there are no groups, items should not be indented. That way they’ll match the appearance of other sections.
It’s a bit awkward and confusing for users who use add-dir-local-variable
to have to remember to type quotation marks for the glob value when setting magit-todos-exclude-globs
. We could convert symbols to strings when building commands, so users wouldn’t have to remember this.
On large repos, updating the section from scratch takes some time. It would be good to avoid doing this too often in large repos.
There should be an option for how often to refresh the to-dos section:
always
manually
- a number of seconds (not automatically, but whenever the status buffer is refreshed and this many seconds have elapsed)
memoize
can be used to implement this, probably with a proxy function to handle always/manually.
- [X]
defvar magit-todos-updating
- Whether the items are being updated now.
- [X]
defcustom magit-todos-update-automatically
- Whether or how often to update the items automatically.
- [X]
defvar-local magit-todos-last-update-time
- When the items were last updated. A time value as returned by
(current-time)
. - [X]
defun magit-todos-update
- Called to do a new scan, update the cache, and insert the section. If the section already exists, it must be removed first.
- [X]
defun magit-todos--delete-section IDENT
- Called to delete the specified section from the status buffer.
- [X]
defvar-local magit-todos-item-cache
- Stores the items found by the scan function.
- [X]
defun magit-todos--insert-items
- Modify to call
magit-todos--insert-items-callback
directly with cached items when automatic updates are disabled. - [X]
defun magit-todos--insert-items-callback
- Modify to:
- [X] Cache items when necessary
- [X] Show that section requires manual updating when no items are cached.
The parsing/insertion should be timed, and if it takes too long, the previous option should be automatically set to timeout or manual.
This will make the changes much simpler. See defscanner-macro
branch.
Choose between magit-popup
and transient
Now that we’re using external scanners, I’m not sure this is important. And if we implement a feature to avoid scanning too often in big repos, it probably won’t be.
e.g. I don’t necessarily need to see each subtask under “Ignore files/directories in scanners”.
e.g. these from this old var:
(defcustom magit-todos-ignore-file-suffixes '(".org_archive" "#")
"Ignore files with these suffixes."
:type '(repeat string))
Should probably use --glob
:
-g, --glob <GLOB>... Include or exclude files and directories for searching that match the given glob. This always overrides any other ignore logic. Multiple glob flags may be used. Globbing rules match .gitignore globs. Precede a glob with a ! to exclude it. --iglob <GLOB>... Include or exclude files and directories for searching that match the given glob. This always overrides any other ignore logic. Multiple glob flags may be used. Globbing rules match .gitignore globs. Precede a glob with a ! to exclude it. Globs are matched case insensitively.
[2020-11-09 Mon 01:59] e.g. when I store a notes file in a worktree directory, it doesn’t get scanned.