diff options
| author | Craig Jennings <c@cjennings.net> | 2026-05-16 02:35:38 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-05-16 02:35:38 -0500 |
| commit | 1c5a2ebab7c721d795ed9331afdb305fd683e172 (patch) | |
| tree | f3c1756585b8f0590a0f381adbb23aedb2be957c /todo.org | |
| parent | 9325ca00173a03f282e74b6a86c4083fa88977d5 (diff) | |
| download | dotemacs-1c5a2ebab7c721d795ed9331afdb305fd683e172.tar.gz dotemacs-1c5a2ebab7c721d795ed9331afdb305fd683e172.zip | |
refactor(foundation): hygiene pass across early-init, user-constants, system-defaults, chrono-tools
Six small fixes the 2026-05-15 module-by-module re-review surfaced:
- Consolidate `user-home-dir` -- canonical defconst stays in
early-init.el (package-archive bootstrap needs it before normal
modules load); user-constants.el switches to a `defvar` with the
identical `(getenv "HOME")` expression so the module still loads /
byte-compiles standalone, but at runtime early-init's defconst
wins.
- Drop the redundant `(autoload 'env-bsd-p ...)` line in
system-defaults.el. The `(eval-when-compile (require
'host-environment))` already exposes the symbol to the byte
compiler, and at runtime host-environment is loaded earlier in
init.el. Added a comment documenting the boundary.
- Convert `cj/debug-modules` and `cj/use-online-repos` from `defvar`
to `defcustom`, with `:type`, `:group 'cj`, and a top-level
`(defgroup cj ...)` so both show up in M-x customize.
- Name the package-archive priorities in early-init.el. Nine new
defconsts replace the magic numbers (200 / 125 / 120 / 115 / 100 /
25 / 20 / 15 / 5) with one constant each, plus a header comment
explaining the local-first ordering and the gnu > nongnu > melpa >
melpa-stable trust ranking within each tier.
- Delete the 19-line commented-out `use-package time` world-clock
block in chrono-tools.el. `time-zones` immediately above is the
active replacement; git history preserves the old config if anyone
needs it.
- Add coverage for `cj/tmr-select-sound-file`. Collapsed the
prefix-arg branch into a delegation to
`cj/tmr-reset-sound-to-default` (single reset source) and
extracted `cj/tmr--available-sound-files` as a pure helper that
tests directly. 9 ERT tests across Normal / Boundary / Error
cover the available-sounds helper, the reset path, the prefix-arg
delegation (no prompt), the normal selection path, and the
empty-dir / missing-dir / cancel boundaries.
Diffstat (limited to 'todo.org')
| -rw-r--r-- | todo.org | 112 |
1 files changed, 57 insertions, 55 deletions
@@ -1022,32 +1022,36 @@ Expected outcome: - Add a small test or validation helper around the computed package policy if package bootstrap is extracted. -**** TODO [#C] Consolidate duplicate =user-home-dir= constant :cleanup: - -=user-home-dir= is defined identically in =early-init.el:116-117= and -=modules/user-constants.el:74-75=. early-init.el defines it first -because =package-archive= paths reference it, then user-constants.el -redefines it. Both definitions silently drift if one is edited. -Consolidate: keep early-init.el's definition (load-order requirement) -and reference it from user-constants.el with a comment explaining why -the constant lives in early-init. - -**** TODO [#C] Drop redundant =eval-when-compile= alongside autoload in =system-defaults.el= :cleanup: - -=modules/system-defaults.el:20-24= wraps host-environment and -user-constants under =eval-when-compile= require forms, then line 24 -also declares =(autoload 'env-bsd-p "host-environment" nil t)=. The -=eval-when-compile= is redundant given the autoload; the mixed pattern -suggests one of the two requires was added without removing the other. -Pick one boundary and document it. - -**** TODO [#C] Convert =cj/debug-modules= and =cj/use-online-repos= to =defcustom= :refactor: - -These are user-facing toggles defined as =defvar= in -=modules/user-constants.el:25-30= and =early-init.el:84-87=. Users -cannot discover or change them through =M-x customize=. Convert to -=defcustom= with =:type=, =:group=, and a docstring so they show up in -the customization UI alongside other config knobs. +**** 2026-05-16 Sat @ 02:34:22 -0500 Consolidated user-home-dir into early-init as canonical + +Canonical defconst in =early-init.el= kept (the package-archive paths +need it during package bootstrap, before normal modules load). +=modules/user-constants.el= switched to a `defvar` with the identical +=(getenv "HOME")= expression and a comment explaining the pattern: +defvar is a no-op at runtime (early-init's defconst wins, defvar +doesn't reassign a bound symbol), but it lets the module load / +byte-compile standalone when early-init hasn't run. Drift risk is +mitigated by both expressions being =(getenv "HOME")= literally; the +comment flags the requirement to keep them identical. + +**** 2026-05-16 Sat @ 02:34:22 -0500 Dropped redundant autoload alongside compile-time require in system-defaults.el + +Kept the =eval-when-compile= requires for =host-environment= and +=user-constants= (they silence free-variable / free-function warnings +during byte-compile in isolation) and dropped the +=(autoload 'env-bsd-p ...)= line — both modules are loaded earlier in +init.el at runtime, and the eval-when-compile already exposes +=env-bsd-p= to the byte-compiler. Added a comment documenting the +chosen boundary. + +**** 2026-05-16 Sat @ 02:34:22 -0500 Converted cj/debug-modules and cj/use-online-repos to defcustom + +Both toggles now live as =defcustom= with explicit =:type= and +=:group 'cj=. =cj/debug-modules='s type is the natural choice form: +either =t= (all modules) or a list of module symbols. +=cj/use-online-repos='s type is boolean. Added a top-level +=(defgroup cj ...)= in early-init.el so the group exists for both, +plus the package-priority constants below it. **** TODO [#B] Surface custom-file redirection so accidental Customize use isn't silent :safety: @@ -1061,35 +1065,33 @@ Customize buffer loses those changes on Emacs exit. Either surface a =custom-file= to a versioned path under =data/= so the discard is at least durable for the session. -**** TODO [#C] Name and document package archive priorities :refactor: - -=early-init.el:149-180= assigns priorities as magic numbers -(localrepo=200, gnu-local=125, melpa-local=115, online gnu=25, -melpa=15, melpa-stable=5). Future maintainers cannot answer "why is -gnu-local 125 but melpa-local 115?" without re-deriving the -hierarchy. Define named constants -(=cj/package-priority-local-mirror=, =cj/package-priority-online=, -etc.) at the top of early-init.el with a short comment explaining the -local-first ordering. - -**** TODO [#C] Remove dead world-clock block in =chrono-tools.el= :cleanup: - -Lines 23-41 carry a 19-line commented-out =use-package time= block -("old world-clock config while testing time-zone package above") left -over from the time-zones migration. Either delete it or replace with -a one-line breadcrumb noting that =time-zones= superseded it. Dead -commented code lengthens the file with no value to future readers. - -**** TODO [#C] Add coverage for =cj/tmr-select-sound-file= in =chrono-tools.el= :tests: - -The two TMR sound-selection helpers (=cj/tmr-select-sound-file= and -=cj/tmr-reset-sound-to-default=) currently have no tests. The select -function has nontrivial branching across the prefix-arg path, the -missing-directory path, the empty-directory path, the cancel path, -and the "default selected" message variant. Refactor the -prefix-arg branch to call =cj/tmr-reset-sound-to-default= directly -so the duplication collapses, then add Normal/Boundary/Error tests -against the resulting helper. +**** 2026-05-16 Sat @ 02:34:22 -0500 Named the package archive priorities in early-init.el + +Nine =defconst= entries replace the magic numbers: +=cj/package-priority-localrepo= (200) for the project-pinned repo, +four =cj/package-priority-mirror-*= entries for the local ELPA +mirrors (125 / 120 / 115 / 100), four =cj/package-priority-online-*= +entries for the online archives (25 / 20 / 15 / 5). A header comment +above the block explains the local-first ordering and the +gnu > nongnu > melpa > melpa-stable trust ranking within each tier. + +**** 2026-05-16 Sat @ 02:34:22 -0500 Deleted dead world-clock block in chrono-tools.el + +The 19-line commented-out =use-package time= block is gone. The +=time-zones= use-package directly above it is the active replacement; +git history preserves the old config if anyone needs to dig it back up. + +**** 2026-05-16 Sat @ 02:34:22 -0500 Added coverage for cj/tmr-select-sound-file with a pre-test refactor + +The prefix-arg branch now delegates to =cj/tmr-reset-sound-to-default= +directly (single source for the reset path). Extracted a pure helper +=cj/tmr--available-sound-files= so the directory scan is testable +without driving =completing-read=. =tests/test-chrono-tools-tmr-sound.el= +covers Normal / Boundary / Error: available-sounds against a populated +dir, empty dir, missing dir; reset path; select with prefix-arg +(delegates to reset, no prompt); select normal (picks a file); select +boundary paths for empty dir, missing dir, cancel (empty completion). +9 tests, all green. *** DOING [#B] Harden custom editing utility modules :harden: |
