Codebase list magit-todos / scrub-obsolete/main notes.org
scrub-obsolete/main

Tree @scrub-obsolete/main (Download .tar.gz)

notes.org @scrub-obsolete/mainraw · history · blame

#+PROPERTY: LOGGING nil

* Ideas

** TODO [#B] Don't indent items when no groups

When there are no groups, items should not be indented.  That way they'll match the appearance of other sections.

** MAYBE Convert glob symbols to strings

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.

** TODO Avoid refreshing section too often [1/2]

On large repos, updating the section from scratch takes some time.  It would be good to avoid doing this too often in large repos.

*** DONE Option for when to refresh it

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.

**** Implementation

+  [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.

*** TODO Set option automatically in large repos

The parsing/insertion should be timed, and if it takes too long, the previous option should be automatically set to timeout or manual.
** TODO UI like magit-popup [2/5]

*** DONE Define scanners with a macro

This will make the changes much simpler.  See =defscanner-macro= branch. 

*** DONE Build regexps on scan invocation
*** TODO Choose between ~magit-popup~ and [[https://github.com/magit/transient][transient]]

*** TODO Implement UI

*** TODO Optionally set dir-local variables with it 

** MAYBE Restore timeout feature

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.

** MAYBE Option to limit depth of Org items

e.g. I don't necessarily need to see each subtask under "Ignore files/directories in scanners".

** TODO Ignore files/directories in scanners

*** TODO Add default globs

e.g. these from this old var:

#+BEGIN_SRC elisp
  (defcustom magit-todos-ignore-file-suffixes '(".org_archive" "#")
    "Ignore files with these suffixes."
    :type '(repeat string))
#+END_SRC

*** TODO rg

Should probably use =--glob=:

#+BEGIN_EXAMPLE
    -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.
#+END_EXAMPLE

*** TODO ag

*** TODO git-grep

*** TODO find-grep

** TODO [#B] Search extra directories

[2020-11-09 Mon 01:59]  e.g. when I store a notes file in a worktree directory, it doesn't get scanned.