[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: nativecomp and throw/catch across files
From: |
Andrea Corallo |
Subject: |
Re: nativecomp and throw/catch across files |
Date: |
Thu, 18 Feb 2021 08:05:59 +0000 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
Aaron Jensen <aaronjensen@gmail.com> writes:
> Hi there,
>
> I've been trying out the nativecomp branch and I use straight.el as my
> package manager.
>
> One of the things that it does is throw when it detects that its own
> compiled bytecode has changed. It does this from within straight.el:
>
> (eval
> `(unless (equal
> (emacs-version)
> ,(eval-when-compile (emacs-version)))
> (throw 'emacs-version-changed nil)))
>
> https://github.com/raxod502/straight.el/blob/2d407bccd9378f1d5218f8ba2ae85c6be73fbaf1/straight.el#L45-L49
>
> It then catches within bootstrap.el, which loads straight.el:
>
> (catch 'emacs-version-changed
> ;; straight.el has a fun hack that throws
> ;; `emacs-version-changed' if the version of Emacs has changed
> ;; since the last time it was byte-compiled. This prevents us
> ;; from accidentally loading invalid byte-code, hopefully.
> (load (expand-file-name (concat straight.el "c")
> default-directory)
> nil 'nomessage 'nosuffix)
> (setq emacs-version-changed nil))
>
> https://github.com/raxod502/straight.el/blob/2d407bccd9378f1d5218f8ba2ae85c6be73fbaf1/bootstrap.el#L47-L54
>
> Unfortunately, this doesn't work with nativecomp. It claims that
> there's no matching catch when a throw actually happens.
>
> Warning (initialization): An error occurred while loading
> ‘/Users/aaronjensen/.emacs.d/early-init.el’:
>
> No catch for tag: emacs-version-changed, nil
>
>
> To reproduce, you should be able to use the bootstrap code:
> https://github.com/raxod502/straight.el#bootstrapping-straightel
>
> Then recompile emacs (which changes the value of emacs-version) and run again.
>
> I tried narrowing it down to just a try/catch in two different files
> and that worked, so there must be something more peculiar going on
> here.
Hi Aaron,
is there a corresponding issue open in straight? Perhaps straight
developers can narrow down the issue and suggest a minimal reproducer in
case this is a real issue on our side.
Thanks
Andrea