From 9b1d563cad3a1484d294896ddbf09689d95b3b5b Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Mon, 25 May 2026 18:29:32 -0500 Subject: feat(system-defaults): warn once when Customize tries to save MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- modules/system-defaults.el | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'modules/system-defaults.el') diff --git a/modules/system-defaults.el b/modules/system-defaults.el index 8ef6181a..eccc6c35 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! -- cgit v1.2.3