Subject: Re: bug#48176: 28.0.50; loadup.el leaves some variables in the lexical environment

From: Lars Ingebrigtsen <[email-masked]>
Date: Mon, 03 May 2021 10:09:00 +0200

Philipp Stephani <[email-masked]> writes:

> After starting Emacs, some spurious variables like `output' or `success'
> are bound.  It looks like they come from loadup.el. 

Oh, interesting.  So it's these that are in the lexical environment when
we're dumping:

    (let ((output (cond ((equal dump-mode "pdump") "emacs.pdmp")
[...]
      (let (success)
        (unwind-protect
             (let ((tmp-dump-mode dump-mode)
                   (dump-mode nil))
               (if (member tmp-dump-mode '("pdump" "pbootstrap"))
                   (dump-emacs-portable (expand-file-name output invocation-directory))
                 (dump-emacs output "temacs")

I guess we could rename the variables to something with a private
prefix, but that's kinda hacky.  Do we have a way to remove some symbols
from the lexical environment?  I.e., extend `dump-emacs-portable' to
take a list of symbols to remove from the dumped lexical environment?
Or...  should the dumper just set the variable to (t)?  (I'm not very
familiar with the internals of how that's supposed to work...)

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no