Subject: Re: bug#52554: 28.0.90; mm-inline-media-tests customization breaks .emacs reading

From: Robert Pluim <[email-masked]>
Date: Fri, 17 Dec 2021 09:45:17 +0100

>>>>> On Fri, 17 Dec 2021 10:29:09 +0200, Eli Zaretskii <[email-masked]> said:

    >> From: Robert Pluim <[email-masked]>
    >> Cc: Andreas Schwab <[email-masked]>,  [email-masked]
    >> Date: Fri, 17 Dec 2021 09:23:48 +0100
    >> 
    >> >> I'd rather think that custom-save-variable should bind
    >> >> print-escape-control-characters to t.
    >> 
    Eli> Maybe we should do both?
    >> 
    >> In `custom-save-all' perhaps? There are many code paths for saving
    >> customizations, they donʼt all go via `custom-save-variable'.

    Eli> If they all go through custom-save-all, then I think it should be done
    Eli> there, yes.

OK, Iʼll run with the following for a while, and see if anything crops
up.

diff --git c/lisp/cus-edit.el i/lisp/cus-edit.el
index 5c4448ae71..1936733098 100644
--- c/lisp/cus-edit.el
+++ i/lisp/cus-edit.el
@@ -4723,7 +4723,10 @@ custom-save-all
         (delay-mode-hooks (emacs-lisp-mode)))
       (let ((inhibit-read-only t)
 	    (print-length nil)
-	    (print-level nil))
+	    (print-level nil)
+            ;; We might be saving byte-code with embedded NULs, which can
+            ;; cause problems when read back (Bug#52554).
+            (print-escape-control-characters t))
         (atomic-change-group
 	  (custom-save-variables)
 	  (custom-save-faces)))
diff --git c/lisp/startup.el i/lisp/startup.el
index 505d7b83f4..f8db46ff3f 100644
--- c/lisp/startup.el
+++ i/lisp/startup.el
@@ -964,7 +964,11 @@ startup--load-user-init-file
         (debug-on-error-initial
          (if (eq init-file-debug t)
              'startup
-           init-file-debug)))
+           init-file-debug))
+        ;; The init file might contain byte-code with embedded NULs,
+        ;; which can cause problems when read back, so disable null
+        ;; byte detection (Bug#52554).
+        (inhibit-null-byte-detection t))
     (let ((debug-on-error debug-on-error-initial))
       (condition-case-unless-debug error
           (when init-file-user

Robert
--