emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Regression in dump-emacs-portable


From: Lynn Winebarger
Subject: Re: Regression in dump-emacs-portable
Date: Fri, 17 Feb 2023 08:22:56 -0500

On Thu, Feb 16, 2023 at 6:45 PM Lynn Winebarger <owinebar@gmail.com> wrote:
>
> On Thu, Feb 16, 2023 at 10:34 AM Eli Zaretskii <eliz@gnu.org> wrote:
> >
> > > From: Lynn Winebarger <owinebar@gmail.com>
> > > Date: Thu, 16 Feb 2023 10:05:00 -0500
> > > Cc: emacs-devel <emacs-devel@gnu.org>
> > >
> > > I do see something in the redumped emacs that seems like a bug to me.  
> > > The process I use for creating the
> > > dump uses the -Q flag.  But some of the settings I see in "emacs -Q 
> > > --dump-file ..." are not the ones I see
> > > with just "emacs -Q".  Some are pretty basic - menu-bar-mode, 
> > > tool-bar-mode, global-font-lock-mode,
> > > transient-mark-mode are all nil in the redumped process but not the 
> > > baseline.
> >
> > That is exactly the problem with re-dumping: stuff that was
> > initialized on the first start gets dumped, and then works differently
> > when Emacs is restarted from the second dump.
>
> That appears to be a consequence of setting
> custom-delayed-init-variables to t in startup, without saving a copy
> to be restored by an after-pdump-load-hook.  Those modes have an
> init-value expression involving "(not noninteractive)"  that is
> evaluated during batch mode startup but not in the post-redump
> startup.
Something like this (untested):
diff --git a/lisp/custom.el b/lisp/custom.el
index 0522bdd447b..c16bc8f8560 100644
--- a/lisp/custom.el
+++ b/lisp/custom.el
@@ -138,6 +138,19 @@ custom-delayed-init-variables
   "List of variables whose initialization is pending until startup.
 Once this list has been processed, this var is set to a non-list value.")

+(defvar custom-pdumped-delayed-init-variables nil
+  "List of all variables whose initialization will be pending until
+a startup following a redump.  This list is prepended to
+custom-delayed-init-variables in an after-pdump-load-hook.")
+(defun custom-delayed-init-variables-reset-after-redump ()
+  "Ensure delayed initializations are performed at startup after redumping"
+  (when custom-pdumped-delayed-init-variables
+    (setq custom-delayed-init-variables
+          (nconc custom-pdumped-delayed-init-variables
+                 custom-delayed-init-variables))))
+(add-hook 'after-pdump-load-hook
+          #'custom-delayed-init-variables-reset-after-redump)
+
 (defun custom-initialize-delay (symbol value)
   "Delay initialization of SYMBOL to the next Emacs start.
 This is used in files that are preloaded (or for autoloaded
diff --git a/lisp/startup.el b/lisp/startup.el
index dcc098f84c3..7947f676827 100644
--- a/lisp/startup.el
+++ b/lisp/startup.el
@@ -1311,6 +1311,7 @@ command-line
             ;; Initialize them in the same order they were loaded, in
             ;; case there are dependencies between them.
             (reverse custom-delayed-init-variables))))
+  (setq custom-pdumped-delayed-init-variables custom-delayed-init-variables)
   (setq custom-delayed-init-variables t)

   ;; Warn for invalid user name.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]