aboutsummaryrefslogtreecommitdiff
path: root/modules/system-defaults.el
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-05-25 18:29:32 -0500
committerCraig Jennings <c@cjennings.net>2026-05-25 18:29:32 -0500
commit391c6ce1edb9f668235b469e5e5798f8b02ce966 (patch)
tree862a2daf3af5a456b612c3287aa14c68380cd215 /modules/system-defaults.el
parentebd93c16cf04933d3e717d4b2a497885157e5bb9 (diff)
downloaddotemacs-391c6ce1edb9f668235b469e5e5798f8b02ce966.tar.gz
dotemacs-391c6ce1edb9f668235b469e5e5798f8b02ce966.zip
feat(system-defaults): warn once when Customize tries to save
custom-file points at a throwaway temp file so Customize edits never persist — deliberate, since config lives in Elisp, but silent. A user who clicks "Save for Future Sessions" loses the edit on exit with no hint. I advise custom-save-all (the chokepoint both customize-save-variable and the Customize button funnel through) with a one-shot :before warning that explains the discard and points at the Elisp init files. The advice removes itself after firing, so it warns once per session, and the body never runs at load, so startup stays quiet.
Diffstat (limited to 'modules/system-defaults.el')
-rw-r--r--modules/system-defaults.el16
1 files changed, 16 insertions, 0 deletions
diff --git a/modules/system-defaults.el b/modules/system-defaults.el
index 8ef6181a8..eccc6c353 100644
--- a/modules/system-defaults.el
+++ b/modules/system-defaults.el
@@ -104,6 +104,22 @@ Used to disable functionality with defalias \='somefunc \='cj/disabled)."
(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'.
+`custom-file' is a temp file that is never read back, so anything saved
+through the Customize interface is lost on exit. This advice fires the
+first time `custom-save-all' writes, then removes itself so the warning
+appears only once per session."
+ (advice-remove 'custom-save-all #'cj/--warn-customize-discarded)
+ (display-warning
+ 'cj/system-defaults
+ (concat "Customize edits are discarded: `custom-file' is a throwaway "
+ "temp file that is never loaded back. Edit configuration in the "
+ "Elisp init files instead.")
+ :warning))
+
+(advice-add 'custom-save-all :before #'cj/--warn-customize-discarded)
+
;; ------------------------- Re-Enabling Functionality -------------------------
(put 'narrow-to-region 'disabled nil) ;; narrow-to-region is extremely useful!