Subject: Re: bug#64232: 28.2; Incorrect(?) byte compilation warning about‘ansi-color-apply-on-region’

From: Stefan Monnier <[email-masked]>
Date: Wed, 28 Jun 2023 09:41:32 -0400

> diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
> index 99202185d8d..f468e34bb42 100644
> --- a/lisp/emacs-lisp/bytecomp.el
> +++ b/lisp/emacs-lisp/bytecomp.el
> @@ -554,7 +554,9 @@ byte-compile-initial-macro-environment
>                                   (let ((byte-compile-unresolved-functions
>                                          byte-compile-unresolved-functions)
>                                         (byte-compile-new-defuns
> -                                        byte-compile-new-defuns))
> +                                        byte-compile-new-defuns)
> +                                       (byte-compile-noruntime-functions
> +                                        byte-compile-noruntime-functions))
>                                     (setf result
>                                           (byte-compile-eval
>                                            (byte-run-strip-symbol-positions

Hmm... this doesn't look right: one of the main purpose of
`byte-compile-eval` is (beside calling `eval`) to populate
`byte-compile-noruntime-functions`, so if you let-bind it around the
call, it's like calling `eval` and we can just get rid of
`byte-compile-noruntime-functions` altogether.

The "natural" place to put the let-binding would be in
`byte-compile-close-variables` (assuming it still fixes the bug).

        Stefan