[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#64232: 28.2; Incorrect(?) byte compilation warning about ‘ansi-color
From: |
Michael Heerdegen |
Subject: |
bug#64232: 28.2; Incorrect(?) byte compilation warning about ‘ansi-color-apply-on-region’ |
Date: |
Wed, 28 Jun 2023 04:10:27 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
"Zack Weinberg" <zack@owlfolio.org> writes:
> ```
> (declare-function ansi-color-apply-on-region "ansi-color"
> (begin end &optional preserve-sequences))
>
> (declare-function dired-get-marked-files "dired"
> (&optional localp arg filter distinguish-one-marked error))
>
> (eval-when-compile
> (check-declare-file byte-compile-current-file))
>
> (defun colorize-buffer ()
> (interactive)
> (ansi-color-apply-on-region (point-min) (point-max)))
>
> (defun find-marked-files ()
> (interactive)
> (mapc 'find-file (dired-get-marked-files)))
> ```
>
> If you visit this file in emacs -Q and then invoke check-declare-file on
> it interactively, check-declare-file generates no warnings, which is
> correct. However, if you invoke `emacs -Q --batch -f batch-byte-compile
> test.el` from the shell, you will get this output:
>
> ```
> uncompressing ansi-color.el.gz...
> uncompressing ansi-color.el.gz...done
> uncompressing dired.el.gz...
> uncompressing dired.el.gz...done
>
> In end of data:
> test.el:13:4: Warning: the function ‘ansi-color-apply-on-region’ might
> not be
> defined at runtime.
> ```
>
> "The function ‘...’ might not be defined" is the phrase used by
> byte-compile-warn-about-unresolved-functions. It's not a check-declare
> diagnostic.
Indeed - so we have an interference between byte compilation,
`eval-when-compile' and `check-declare-file'. This seems to help and
might (?) be a good thing to do anyway:
From e972af2cd4d27b42cad7cf697bcfa32127cb0591 Mon Sep 17 00:00:00 2001
From: Michael Heerdegen <michael_heerdegen@web.de>
Date: Wed, 28 Jun 2023 04:02:44 +0200
Subject: [PATCH] WIP: Try to fix Bug#64232
---
lisp/emacs-lisp/bytecomp.el | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
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
--
2.30.2
Would be nice if someone like Stefan or Mattias could tell whether this
is an appropriate addition (independently from this obscure issue).
Michael.
- 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 <=
- 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, 2023/06/29
- 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