Subject: Re: bug#49507: 28.0.50; macOS: Symbol’s value as variable is void: lock-file-name-transforms

From: Stefan Monnier <[email-masked]>
Date: Sun, 11 Jul 2021 12:42:49 -0400

>> I don't see why being defined in C would be relevant, no.
> Because those are always defined when the startup code runs.  By
> contrast, if you define them in some preloaded Lisp file, the
> defcustom form could run before the preloaded Lisp is restored from
> the pdumper file.

The error indeed came from the fact that the var is not defined when
`defcustom` is executed but instead only later on, when the predumped
Emacs is executed (in `startup.el`).

But to some extent it's only a side effect of the current implementation
of `custom-initialize-delay`.  We could change it to also define the
variable when the `defcustom` is executed.  [ AFAICT that should be
mostly painless, but past experience with this functionality tells me
that this change would inevitably introduce some unforeseen change
which we'd only discover a few months later ;-)  ]

The underlying functionality is needed for any variable that's
predefined in the dump and yet whose default value can't be precomputed
when we dump Emacs.  A `grep` shows that the vast majority of those
variables are defined in ELisp.

        Stefan