unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Michael Heerdegen <michael_heerdegen@web.de>
To: Zack Weinberg <zack@owlfolio.org>
Cc: Eli Zaretskii <eliz@gnu.org>,
	64232@debbugs.gnu.org, Stefan Monnier <monnier@iro.umontreal.ca>
Subject: bug#64232: 28.2; Incorrect(?) byte compilation warning about ‘ansi-color-apply-on-region’
Date: Wed, 28 Jun 2023 04:10:27 +0200	[thread overview]
Message-ID: <87jzvoe3qk.fsf@web.de> (raw)
In-Reply-To: <9c38fe1a-ee3a-4b6d-aaa7-33aa4909e331@app.fastmail.com> (Zack Weinberg's message of "Sat, 24 Jun 2023 11:15:42 -0400")

[-- Attachment #1: Type: text/plain, Size: 1535 bytes --]

"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:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-WIP-Try-to-fix-Bug-64232.patch --]
[-- Type: text/x-diff, Size: 1254 bytes --]

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


[-- Attachment #3: Type: text/plain, Size: 152 bytes --]


Would be nice if someone like Stefan or Mattias could tell whether this
is an appropriate addition (independently from this obscure issue).


Michael.

  reply	other threads:[~2023-06-28  2:10 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-22 19:56 bug#64232: 28.2; Incorrect(?) byte compilation warning about ‘ansi-color-apply-on-region’ Zack Weinberg
2023-06-24 11:49 ` Eli Zaretskii
2023-06-24 15:15   ` Zack Weinberg
2023-06-28  2:10     ` Michael Heerdegen [this message]
2023-06-28 13:41       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-06-29  3:43         ` Michael Heerdegen
2023-06-29  4:51           ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-06-30  4:02             ` Michael Heerdegen
2023-06-30  6:00               ` Eli Zaretskii
2023-07-06  6:43                 ` Eli Zaretskii
2023-07-07 16:10                   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-07-07 18:15                     ` Eli Zaretskii
2023-06-29  4:17 ` Michael Heerdegen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87jzvoe3qk.fsf@web.de \
    --to=michael_heerdegen@web.de \
    --cc=64232@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=zack@owlfolio.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).