aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-06-15 21:40:54 -0500
committerCraig Jennings <c@cjennings.net>2026-06-15 21:40:54 -0500
commit79a38fe13bed9c9824ff4eb943de22da69b09b7f (patch)
treea84dd70429bc86d3fea3bf15d20cbde3cc3ff567 /modules
parentcd95ea79d004ca874dcc17dc2334f25efdb1bf9a (diff)
downloaddotemacs-79a38fe13bed9c9824ff4eb943de22da69b09b7f.tar.gz
dotemacs-79a38fe13bed9c9824ff4eb943de22da69b09b7f.zip
fix(system-defaults): guard server-start and custom-file against batch
A raw module load under --batch started a server and dropped a throwaway custom-file temp on every run; the suite only passed because a testutil stubbed the server. Guard both with (unless noninteractive ...), the established pattern here. Adds a batch-load test for the custom-file guard.
Diffstat (limited to 'modules')
-rw-r--r--modules/system-defaults.el11
1 files changed, 8 insertions, 3 deletions
diff --git a/modules/system-defaults.el b/modules/system-defaults.el
index 1703b1bf7..0062a82cf 100644
--- a/modules/system-defaults.el
+++ b/modules/system-defaults.el
@@ -101,8 +101,11 @@ Used to disable functionality with defalias \='somefunc \='cj/disabled)."
;; CUSTOMIZATIONS
;; All customizations should be declared in Emacs init files.
;; Add accidental customizations via the customization interface to a temp file that's never read.
-(setq custom-file (make-temp-file
- "emacs-customizations-trashbin-"))
+;; Guarded so a batch module load (make validate-modules, byte-compile) doesn't
+;; create a throwaway temp file on every run.
+(unless noninteractive
+ (setq custom-file (make-temp-file
+ "emacs-customizations-trashbin-")))
(defun cj/--warn-customize-discarded (&rest _)
"Warn once that Customize edits land in a throwaway `custom-file'.
@@ -137,7 +140,9 @@ appears only once per session."
;; -------------------------------- Emacs Server -------------------------------
;; Start server so emacsclient can connect (needed for pinentry-emacs in terminal)
-(unless (or (daemonp) (server-running-p))
+;; noninteractive guard: a raw module load under --batch (make validate-modules
+;; on a machine with no daemon socket) would otherwise start a server.
+(unless (or noninteractive (daemonp) (server-running-p))
(server-start))
(setq system-time-locale "C") ;; use en_US locale to format time.