GNU bug report logs -
#64232
28.2; Incorrect(?) byte compilation warning about ‘ansi-color-apply-on-region’
Previous Next
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 #14 received at 64232 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
"Zack Weinberg" <zack <at> 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:
[0001-WIP-Try-to-fix-Bug-64232.patch (text/x-diff, inline)]
From e972af2cd4d27b42cad7cf697bcfa32127cb0591 Mon Sep 17 00:00:00 2001
From: Michael Heerdegen <michael_heerdegen <at> 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
[Message part 3 (text/plain, inline)]
Would be nice if someone like Stefan or Mattias could tell whether this
is an appropriate addition (independently from this obscure issue).
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.