aboutsummaryrefslogtreecommitdiff
path: root/modules/user-constants.el
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-05-16 02:35:38 -0500
committerCraig Jennings <c@cjennings.net>2026-05-16 02:35:38 -0500
commit1c5a2ebab7c721d795ed9331afdb305fd683e172 (patch)
treef3c1756585b8f0590a0f381adbb23aedb2be957c /modules/user-constants.el
parent9325ca00173a03f282e74b6a86c4083fa88977d5 (diff)
downloaddotemacs-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 'modules/user-constants.el')
-rw-r--r--modules/user-constants.el24
1 files changed, 18 insertions, 6 deletions
diff --git a/modules/user-constants.el b/modules/user-constants.el
index 21e141a5..2cc4a50c 100644
--- a/modules/user-constants.el
+++ b/modules/user-constants.el
@@ -22,12 +22,15 @@
;; -------------------------------- Debug Toggle -------------------------------
-(defvar cj/debug-modules nil
+(defcustom cj/debug-modules nil
"List of modules with debug functions enabled.
-Possible values: org-agenda, mail, chime, etc.
Set to t to enable all debug modules.
-Example: (setq cj/debug-modules '(org-agenda mail))
- (setq cj/debug-modules t) ; Enable all")
+Set to a list of module symbols (e.g. \\='(org-agenda mail)) to enable
+debug output for those modules only. Possible values: org-agenda,
+mail, chime, etc."
+ :type '(choice (const :tag "All modules" t)
+ (repeat :tag "Specific modules" symbol))
+ :group 'cj)
;; -------------------------------- Contact Info -------------------------------
@@ -71,8 +74,17 @@ the regular transcription pipeline.")
(defconst emacs-early-init-file (expand-file-name "early-init.el" user-emacs-directory)
"The location of Emacs's early init file.")
-(defconst user-home-dir (getenv "HOME")
- "The user's home directory per the environment variable.")
+;; Canonical definition of `user-home-dir' lives in `early-init.el' so
+;; the package-archive paths there can reference it during package
+;; bootstrap. The `defvar' below is a no-op at runtime (early-init's
+;; defconst wins, defvar doesn't reassign a bound symbol) -- it exists
+;; only so this module loads / byte-compiles standalone, when
+;; early-init hasn't run. If you ever change the expression here, keep
+;; it identical to early-init.el's.
+(defvar user-home-dir (getenv "HOME")
+ "The user's home directory per the environment variable.
+Canonical definition in early-init.el; this form is a standalone-load
+fallback only.")
(defconst books-dir (expand-file-name "sync/books/" user-home-dir)
"The location of book files for CalibreDB.")