GNU bug report logs - #64232
28.2; Incorrect(?) byte compilation warning about ‘ansi-color-apply-on-region’

Previous Next

Package: emacs;

Reported by: Zack Weinberg <zack <at> owlfolio.org>

Date: Thu, 22 Jun 2023 19:57:02 UTC

Severity: normal

Found in version 28.2

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

Full log


Message #20 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Michael Heerdegen <michael_heerdegen <at> web.de>
To: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of
 text editors" <bug-gnu-emacs <at> gnu.org>
Cc: Eli Zaretskii <eliz <at> gnu.org>, Zack Weinberg <zack <at> owlfolio.org>,
 64232 <at> debbugs.gnu.org, Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#64232: 28.2; Incorrect(?) byte compilation warning about
 ‘ansi-color-apply-on-region’
Date: Thu, 29 Jun 2023 05:43:13 +0200
Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of
text editors" <bug-gnu-emacs <at> gnu.org> writes:

> > --- 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.

Hmm - ok.

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

Seems it does not.  Maybe we should try to understand what is happening
first.

Part of the problem is the dependency

  check-declare -> compile -> comint -> ansi-color

so the compiler might think we are `requiring' ansi-color (which the
compiled file uses) inside our `eval-when-compile' by purpose.

The warning is the same as when one did just

#+begin_src emacs-lisp
(eval-when-compile
  (require 'ansi-color))
#+end_src

When removing that `eval-when-compile' the warning message goes away.
So the compiler warns stricter when something is required inside
`eval-when-compile', even if there would be no warning at all without
it.


Michael.




This bug report was last modified 1 year and 323 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.