[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#64232: 28.2; Incorrect(?) byte compilation warning about ‘ansi-color
From: |
Stefan Monnier |
Subject: |
bug#64232: 28.2; Incorrect(?) byte compilation warning about ‘ansi-color-apply-on-region’ |
Date: |
Thu, 29 Jun 2023 00:51:08 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
> 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.
Indeed, it's a vaguely known problem which we haven't tried to
fix seriously.
The usual workaround is to shuffle things around (e.g. move the
(eval-when-compile
(check-declare-file byte-compile-current-file))
earlier or later in the file) ... until the warnings disappear :-(
Someone™ should sit down and figure out how to make `bytecomp.el` keep
track of those things more reliably/predictably.
In the mean time, maybe we can simply tweak `byte-compile-eval` so it
never adds to `byte-compile-noruntime-functions` functions which have
already been seen/declared during the current compilation?
Stefan
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index 99202185d8d..cfec4b3be06 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -1128,7 +1128,8 @@ byte-compile-eval
;; we arguably should add it to b-c-noruntime-functions,
;; but it's not clear it's worth the trouble
;; trying to recognize that case.
- (unless (get f 'function-history)
+ (unless (or (get f 'function-history)
+ (assq f byte-compile-function-environment))
(push f byte-compile-noruntime-functions)))))))))))))
(defun byte-compile-eval-before-compile (form)
- bug#64232: 28.2; Incorrect(?) byte compilation warning about ‘ansi-color-apply-on-region’, Zack Weinberg, 2023/06/22
- bug#64232: 28.2; Incorrect(?) byte compilation warning about ‘ansi-color-apply-on-region’, Eli Zaretskii, 2023/06/24
- bug#64232: 28.2; Incorrect(?) byte compilation warning about ‘ansi-color-apply-on-region’, Zack Weinberg, 2023/06/24
- bug#64232: 28.2; Incorrect(?) byte compilation warning about ‘ansi-color-apply-on-region’, Michael Heerdegen, 2023/06/27
- bug#64232: 28.2; Incorrect(?) byte compilation warning about ‘ansi-color-apply-on-region’, Stefan Monnier, 2023/06/28
- bug#64232: 28.2; Incorrect(?) byte compilation warning about ‘ansi-color-apply-on-region’, Michael Heerdegen, 2023/06/28
- bug#64232: 28.2; Incorrect(?) byte compilation warning about ‘ansi-color-apply-on-region’,
Stefan Monnier <=
- bug#64232: 28.2; Incorrect(?) byte compilation warning about ‘ansi-color-apply-on-region’, Michael Heerdegen, 2023/06/30
- bug#64232: 28.2; Incorrect(?) byte compilation warning about ‘ansi-color-apply-on-region’, Eli Zaretskii, 2023/06/30
bug#64232: 28.2; Incorrect(?) byte compilation warning about ‘ansi-color-apply-on-region’, Michael Heerdegen, 2023/06/29