aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-05-07 19:25:29 -0500
committerCraig Jennings <c@cjennings.net>2026-05-07 19:25:29 -0500
commit83d89d156e53e66325a2f76433f4d3b7cad66169 (patch)
tree6afe628ac98e2e28c871ec5b78c91fddd2777252
parent887672acafeb105c7d676fcc1f0ea23d9c9d23c4 (diff)
downloaddotemacs-83d89d156e53e66325a2f76433f4d3b7cad66169.tar.gz
dotemacs-83d89d156e53e66325a2f76433f4d3b7cad66169.zip
chore(modules): pass validate-modules in batch by adding requires
`make validate-modules` had 19 module-load failures, all the same shape: a module references a symbol or feature owned by another module without saying so. Production was fine because init.el orders requires correctly. The batch target loads each module in isolation, though, and surfaces the gap. I added explicit `(require 'keybindings)` or `(require 'user-constants)` to each affected module. The requires are idempotent at runtime, so production load order is unchanged. For three optional packages (elpa-mirror, mu4e, org-contacts), I switched to `(require 'X nil t)` so the modules load cleanly when those packages aren't installed. The activation calls become no-ops in that case. `make validate-modules` now reports 0 failures.
-rw-r--r--modules/custom-case.el2
-rw-r--r--modules/custom-comments.el2
-rw-r--r--modules/custom-datetime.el3
-rw-r--r--modules/custom-line-paragraph.el2
-rw-r--r--modules/custom-misc.el3
-rw-r--r--modules/custom-ordering.el3
-rw-r--r--modules/custom-text-enclose.el3
-rw-r--r--modules/custom-whitespace.el2
-rw-r--r--modules/erc-config.el1
-rw-r--r--modules/font-config.el1
-rw-r--r--modules/local-repository.el2
-rw-r--r--modules/mu4e-org-contacts-integration.el7
-rw-r--r--modules/mu4e-org-contacts-setup.el11
-rw-r--r--modules/music-config.el1
-rw-r--r--modules/org-config.el2
-rw-r--r--modules/org-noter-config.el2
-rw-r--r--modules/test-runner.el2
-rw-r--r--modules/vc-config.el3
18 files changed, 31 insertions, 21 deletions
diff --git a/modules/custom-case.el b/modules/custom-case.el
index a4e0c0e09..3f7ebc4d7 100644
--- a/modules/custom-case.el
+++ b/modules/custom-case.el
@@ -16,7 +16,7 @@
;;
;;; Code:
-(eval-when-compile (defvar cj/custom-keymap)) ;; cj/custom-keymap defined in keybindings.el
+(require 'keybindings) ;; provides cj/custom-keymap
(defun cj/upcase-dwim ()
"Upcase the active region, or upcase the symbol at point if no region."
diff --git a/modules/custom-comments.el b/modules/custom-comments.el
index 0d83d31b1..d5419be2d 100644
--- a/modules/custom-comments.el
+++ b/modules/custom-comments.el
@@ -52,7 +52,7 @@
;;
;;; Code:
-(eval-when-compile (defvar cj/custom-keymap)) ;; cj/custom-keymap defined in keybindings.el
+(require 'keybindings) ;; provides cj/custom-keymap
(autoload 'cj/join-line-or-region "custom-line-paragraph" nil t)
;; ======================== Comment Manipulation Functions =====================
diff --git a/modules/custom-datetime.el b/modules/custom-datetime.el
index 5b06d81a9..1c5f40f29 100644
--- a/modules/custom-datetime.el
+++ b/modules/custom-datetime.el
@@ -29,8 +29,7 @@
;;
;;; Code:
-;; cj/custom-keymap defined in keybindings.el
-(eval-when-compile (defvar cj/custom-keymap))
+(require 'keybindings) ;; provides cj/custom-keymap
;; ----------------------------- Readable Date Time ----------------------------
diff --git a/modules/custom-line-paragraph.el b/modules/custom-line-paragraph.el
index 4b0baa90e..27f24cfe2 100644
--- a/modules/custom-line-paragraph.el
+++ b/modules/custom-line-paragraph.el
@@ -17,7 +17,7 @@
;;; Code:
-(eval-when-compile (defvar cj/custom-keymap)) ;; defined in keybindings.el
+(require 'keybindings) ;; provides cj/custom-keymap
(declare-function er/mark-paragraph "expand-region") ;; for cj/join-paragraph
(defun cj/join-line-or-region ()
diff --git a/modules/custom-misc.el b/modules/custom-misc.el
index 7ba5a054b..b612e5408 100644
--- a/modules/custom-misc.el
+++ b/modules/custom-misc.el
@@ -14,8 +14,7 @@
;;
;;; Code:
-;; cj/custom-keymap defined in keybindings.el
-(eval-when-compile (defvar cj/custom-keymap))
+(require 'keybindings) ;; provides cj/custom-keymap
(defun cj/jump-to-matching-paren ()
"Jump to the matching delimiter if point is on (or just after) one.
diff --git a/modules/custom-ordering.el b/modules/custom-ordering.el
index f69729103..81490b658 100644
--- a/modules/custom-ordering.el
+++ b/modules/custom-ordering.el
@@ -21,9 +21,8 @@
;;; Code:
(require 'cl-lib)
+(require 'keybindings) ;; provides cj/custom-keymap
-;; cj/custom-keymap defined in keybindings.el
-(eval-when-compile (defvar cj/custom-keymap))
(defvar cj/ordering-map)
(defun cj/--arrayify (start end quote &optional prefix suffix)
diff --git a/modules/custom-text-enclose.el b/modules/custom-text-enclose.el
index e93e6deab..ebfb44e95 100644
--- a/modules/custom-text-enclose.el
+++ b/modules/custom-text-enclose.el
@@ -21,8 +21,7 @@
;;; Code:
-;; cj/custom-keymap defined in keybindings.el
-(eval-when-compile (defvar cj/custom-keymap))
+(require 'keybindings) ;; provides cj/custom-keymap
(defun cj/--surround (text surround-string)
"Internal implementation: Surround TEXT with SURROUND-STRING.
diff --git a/modules/custom-whitespace.el b/modules/custom-whitespace.el
index d5f8d80cd..622ba5f48 100644
--- a/modules/custom-whitespace.el
+++ b/modules/custom-whitespace.el
@@ -17,7 +17,7 @@
;;; Code:
-(eval-when-compile (defvar cj/custom-keymap)) ;; cj/custom-keymap defined in keybindings.el
+(require 'keybindings) ;; provides cj/custom-keymap
;;; ---------------------- Whitespace Operations And Keymap ---------------------
diff --git a/modules/erc-config.el b/modules/erc-config.el
index e7efb33f0..76e7e74ec 100644
--- a/modules/erc-config.el
+++ b/modules/erc-config.el
@@ -17,6 +17,7 @@
;; Load cl-lib at compile time and runtime (lightweight, already loaded in most configs)
(require 'cl-lib)
+(require 'keybindings) ;; provides cj/custom-keymap
(eval-when-compile (require 'erc)
(require 'user-constants))
diff --git a/modules/font-config.el b/modules/font-config.el
index f7c3af5fe..811763f7f 100644
--- a/modules/font-config.el
+++ b/modules/font-config.el
@@ -45,6 +45,7 @@
;;; Code:
(require 'host-environment)
+(require 'keybindings) ;; establishes the C-z prefix used for "C-z F" below
;; ---------------------- HarfBuzz Font Cache Crash Fix -----------------------
;; Prevents Emacs from compacting font caches during GC. Without this, GC can
diff --git a/modules/local-repository.el b/modules/local-repository.el
index ab4daac95..e95b88df4 100644
--- a/modules/local-repository.el
+++ b/modules/local-repository.el
@@ -5,7 +5,7 @@
;;; Code:
-(require 'elpa-mirror)
+(require 'elpa-mirror nil t) ;; optional; cj/update-localrepo-repository fails at call-time if absent
;; ------------------------------ Utility Function -----------------------------
diff --git a/modules/mu4e-org-contacts-integration.el b/modules/mu4e-org-contacts-integration.el
index 7fe893891..8ffdccd2d 100644
--- a/modules/mu4e-org-contacts-integration.el
+++ b/modules/mu4e-org-contacts-integration.el
@@ -7,8 +7,11 @@
;;; Code:
-(require 'mu4e)
-(require 'org-contacts)
+;; Both deps are optional at file-load time. The functions defined here only
+;; fire from mu4e/org-msg compose hooks, so a missing package means the
+;; activation call is a no-op rather than a load-time error.
+(require 'mu4e nil t)
+(require 'org-contacts nil t)
;; ---------------------- Completion at Point Function -------------------------
diff --git a/modules/mu4e-org-contacts-setup.el b/modules/mu4e-org-contacts-setup.el
index 9936de959..034e74574 100644
--- a/modules/mu4e-org-contacts-setup.el
+++ b/modules/mu4e-org-contacts-setup.el
@@ -7,11 +7,12 @@
;;; Code:
-;; Load the integration module
-(require 'mu4e-org-contacts-integration)
-
-;; Activate the integration
-(cj/activate-mu4e-org-contacts-integration)
+;; Load the integration module. Activation only runs when the module loaded
+;; cleanly AND mu4e is present; otherwise this file is a no-op so the rest
+;; of the config can load without mu4e installed.
+(when (require 'mu4e-org-contacts-integration nil t)
+ (when (featurep 'mu4e)
+ (cj/activate-mu4e-org-contacts-integration)))
;; Optional: If you want to use org-contacts as the primary source,
;; you might want to disable mu4e's contact caching to save memory
diff --git a/modules/music-config.el b/modules/music-config.el
index 08ce06582..10cad0627 100644
--- a/modules/music-config.el
+++ b/modules/music-config.el
@@ -83,6 +83,7 @@
(require 'subr-x)
(require 'user-constants)
+(require 'keybindings) ;; provides cj/custom-keymap
;;; Settings (no Customize)
diff --git a/modules/org-config.el b/modules/org-config.el
index 3cd5d358a..c817f3e03 100644
--- a/modules/org-config.el
+++ b/modules/org-config.el
@@ -6,6 +6,8 @@
;;; Code:
+(require 'keybindings) ;; provides cj/custom-keymap (used in :init below)
+
;; ---------------------------- Org General Settings ---------------------------
(defun cj/org-general-settings ()
diff --git a/modules/org-noter-config.el b/modules/org-noter-config.el
index 34a9a6938..0ba31bf71 100644
--- a/modules/org-noter-config.el
+++ b/modules/org-noter-config.el
@@ -24,6 +24,8 @@
;;; Code:
(require 'cl-lib)
+(require 'user-constants) ;; provides roam-dir
+(require 'keybindings) ;; provides cj/custom-keymap
;; Forward declarations
(declare-function org-id-uuid "org-id")
diff --git a/modules/test-runner.el b/modules/test-runner.el
index 138652361..1c9934467 100644
--- a/modules/test-runner.el
+++ b/modules/test-runner.el
@@ -65,10 +65,10 @@
(require 'ert)
(require 'cl-lib)
+(require 'keybindings) ;; provides cj/custom-keymap
;;; External Variables and Functions
-(defvar cj/custom-keymap) ; Defined in init.el
(declare-function projectile-project-root "projectile" ())
;;; Variables
diff --git a/modules/vc-config.el b/modules/vc-config.el
index 7865d0f48..c76e714ea 100644
--- a/modules/vc-config.el
+++ b/modules/vc-config.el
@@ -14,6 +14,9 @@
;;; Code:
+(require 'user-constants) ;; provides code-dir
+(require 'keybindings) ;; provides cj/custom-keymap
+
;; ---------------------------- Magit Configuration ----------------------------
(use-package magit