"Stephen J. Turnbull" <turnbull(a)sk.tsukuba.ac.jp> writes:
Works for me. Will apply shortly since Olivier approves.
2000-09-28 Stephen J. Turnbull <stephen(a)xemacs.org>
* dumper.c (pdump_load_finish): move restoration of
`noninteractive1' to emacs.c (main_1).
* emacs.c (main_1): protect LISP-visible command-line flags
from pdump_load().
I think this patch is wrong. Sorry for not reviewing it earlier.
AFAICT what happens with this patch at run-time (not build time) is:
- a variable (say, inhibit_autoloads) is declared in emacs.c directly
in C with 'int inhibit_autoloads;' no DEFVAR macros involved! note
it doesn't get initialised to anything.
- Command line options are parsed. inhibit_autoloads potentially gets
set to 1.
- Its value is saved in inhibit_autoloads_save
- The pdump file is loaded, thus the normal DEFVAR_BOOL
initialisation from vars_of_emacs() takes effect.
- The saved value inhibit_autoloads_save is written back to
inhibit_autoloads
I think it is rather bad style to save&restore values we have never
initialised to anything. In particular all this breaks for values
which get set to 1 by default in vars_of_emacs(), like
inhibit_site_[lisp|modules] (at least depending on configure time
constants).
+/* WARNING!
+
+ Some LISP-visible command-line options are set by XEmacs _before_ the
+ data is dumped in building a --pdump XEmacs, but used _after_ it is
+ restored in normal operation. Thus the restored values overwrite the
+ values XEmacs is getting at run-time. Such variables must be saved
+ before loading the dumpfile, and restored afterward.
+
+ This is done immediately before and after pdump_load() in main_1().
+ See main_1() for the current list of protected variables.
+
+ Note that if the variable is never DEFVAR'd, saving/restoring is not
+ needed.
I assume that this last sentence is meant to refer to
INHIBIT_SITE_LISP and _MODULES? They are always DEFVAR'd. It is the
*initialisation* to 1 that is conditional.
+ int inhibit_early_packages_save = inhibit_early_packages;
+ int inhibit_autoloads_save = inhibit_autoloads;
+ int debug_paths_save = debug_paths;
+#ifdef INHIBIT_SITE_LISP
+ int inhibit_site_lisp_save = inhibit_site_lisp;
+#endif
+#ifdef INHIBIT_SITE_MODULES
+ int inhibit_site_modules_save = inhibit_site_modules;
+#endif
from vars_of_emacs().
DEFVAR_BOOL ("inhibit-site-lisp", &inhibit_site_lisp /*
Set to non-nil when the site-lisp should not be searched at startup.
*/ );
#ifdef INHIBIT_SITE_LISP
inhibit_site_lisp = 1;
#endif
Finally I don't see a way to affect inhibit_site_lisp by command line
options anyway, thus making the whole save&restore thing overkill.
Maybe there should be a command line option? Michael?
Gunnar