diff options
| author | Craig Jennings <c@cjennings.net> | 2026-05-25 19:06:13 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-05-25 19:06:13 -0500 |
| commit | 423ca0e8e502661343a8aa02d5c58c5029e40b03 (patch) | |
| tree | b166d0026243ef57d225a15aa1dae0540be8bfd3 /init.el | |
| parent | d09de2adf2c727410743c373230cd466baa9d170 (diff) | |
| download | dotemacs-423ca0e8e502661343a8aa02d5c58c5029e40b03.tar.gz dotemacs-423ca0e8e502661343a8aa02d5c58c5029e40b03.zip | |
refactor(user-constants): move filesystem creation out of module load
(require 'user-constants) created ~8 directories and ~10 org/calendar files at load time, via a top-level dolist for the calendar stubs and a top-level call to cj/initialize-user-directories-and-files. That meant any bare require — tests, byte-compile, batch tools — wrote to disk. It's why a stray sync/org/ tree kept appearing in the repo during test runs.
I removed both top-level forms and folded the gcal/pcal/dcal creation into the initializer. The path defconsts stay exactly as they were, so every consumer that just reads a path is unaffected. init.el now calls the initializer right after requiring the module, guarded by (unless noninteractive), so interactive and daemon startup create everything in the same order as before while a bare require stays side-effect-free.
Added tests/test-user-constants.el: loading the module creates nothing, and the initializer creates the backbone dirs and the configured files. Updated the module header — top-level side effects are now none and it's safe to load in tests.
Diffstat (limited to 'init.el')
| -rw-r--r-- | init.el | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -21,6 +21,8 @@ (require 'system-lib) ;; low-level system utility functions (require 'config-utilities) ;; enable for extra Emacs config debug helpers (require 'user-constants) ;; paths for files referenced in this config +(unless noninteractive + (cj/initialize-user-directories-and-files)) ;; create configured dirs/files on real startup (require 'host-environment) ;; convenience functions re: host environment (require 'keyboard-compat) ;; terminal/GUI keyboard compatibility (require 'system-defaults) ;; native comp; log; unicode, backup, exec path |
