* doc/lispref/internals.texi (Building Emacs): Document it.
* lisp/subr.el (after-pdump-load-hook): New variable.
* src/emacs.c (main): Run the new hook.
* src/pdumper.c (syms_of_pdumper): Define a symbol.
If you want to use this function in an Emacs that was already dumped,
you must run Emacs with the @samp{-batch} option.
+
+@vindex after-pdump-load-hook
+If you're including @samp{.el} files in the dumped Emacs and that
+@samp{.el} file has code that is normally run at load time, that code
+won't be run when Emacs starts after dumping. To help work around
+that problem, you can put functions on the
+@code{after-pdump-load-hook} hook. This hook is run when starting
+Emacs.
@end defun
@defun dump-emacs to-file from-file
** Emacs now has a --fingerprint option.
This will output a string identifying the current Emacs build.
++++
+** New hook 'after-pdump-load-hook'.
+This is run at the end of the Emacs startup process, and it meant to
+be used to reinitialize structures that would normally be done at load
+time.
+
\f
* Changes in Emacs 29.1
(defvar suspend-resume-hook nil
"Normal hook run by `suspend-emacs', after Emacs is continued.")
+(defvar after-pdump-load-hook nil
+ "Normal hook run after loading the .pdmp file.")
+
(defvar temp-buffer-show-hook nil
"Normal hook run by `with-output-to-temp-buffer' after displaying the buffer.
When the hook runs, the temporary buffer is current, and the window it
if (dump_mode)
Vdump_mode = build_string (dump_mode);
+#ifdef HAVE_PDUMPER
+ /* Allow code to be run (mostly useful after redumping). */
+ safe_run_hooks (Qafter_pdump_load_hook);
+#endif
+
/* Enter editor command loop. This never returns. */
set_initial_minibuffer_mode ();
Frecursive_edit ();
dump_mmap_release (§ions[i]);
if (dump_fd >= 0)
emacs_close (dump_fd);
+
return err;
}
DEFSYM (Qdumped_with_pdumper, "dumped-with-pdumper");
DEFSYM (Qload_time, "load-time");
DEFSYM (Qdump_file_name, "dump-file-name");
+ DEFSYM (Qafter_pdump_load_hook, "after-pdump-load-hook");
defsubr (&Spdumper_stats);
#endif /* HAVE_PDUMPER */
}