From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Zack Weinberg Newsgroups: gmane.emacs.bugs Subject: bug#64232: 28.2; Incorrect(?) byte compilation warning about =?UTF-8?Q?=E2=80=98ansi-color-apply-on-region=E2=80=99?= Date: Thu, 22 Jun 2023 15:56:18 -0400 Message-ID: <874jmzs23h.wl-zack@owlfolio.org> Mime-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=ISO-8859-7 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33068"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Wanderlust/2.15.9 (Almost Unreal) To: 64232@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Jun 22 21:57:27 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qCQQo-0008Ml-NV for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 22 Jun 2023 21:57:27 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qCQQY-0001Ff-DZ; Thu, 22 Jun 2023 15:57:10 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qCQQS-0001DC-4r for bug-gnu-emacs@gnu.org; Thu, 22 Jun 2023 15:57:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qCQQQ-000863-PM for bug-gnu-emacs@gnu.org; Thu, 22 Jun 2023 15:57:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qCQQQ-0006jU-Kv for bug-gnu-emacs@gnu.org; Thu, 22 Jun 2023 15:57:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Zack Weinberg Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 22 Jun 2023 19:57:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 64232 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.168746379425829 (code B ref -1); Thu, 22 Jun 2023 19:57:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 22 Jun 2023 19:56:34 +0000 Original-Received: from localhost ([127.0.0.1]:36831 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qCQPy-0006iW-1b for submit@debbugs.gnu.org; Thu, 22 Jun 2023 15:56:34 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:46024) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qCQPv-0006iL-GN for submit@debbugs.gnu.org; Thu, 22 Jun 2023 15:56:32 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qCQPt-00013l-GU for bug-gnu-emacs@gnu.org; Thu, 22 Jun 2023 15:56:30 -0400 Original-Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qCQPp-0007ys-NB for bug-gnu-emacs@gnu.org; Thu, 22 Jun 2023 15:56:28 -0400 Original-Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id A04605C019B for ; Thu, 22 Jun 2023 15:56:19 -0400 (EDT) Original-Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Thu, 22 Jun 2023 15:56:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=owlfolio.org; h= cc:content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:message-id:mime-version:reply-to:sender :subject:subject:to:to; s=fm1; t=1687463779; x=1687550179; bh=sb ZTjoYsB+s72wSHwJUPLQeIDvOKgNcuRssyGhtr3Jk=; b=UPcQ2Kx8FLF8iQGAPd SQlruq3QgLAW5wrIXqYxWTfQgu8MfEqxIJL904+It2b1T8f3JirUinQ63JJ/TReS ExwgDSplxch8W5+r83bf5v0VmXeAN1Md1zjv+PPBkdFf0rZJAHNcpJUxkAiEqGYY HykRM2UDQ+CVZWiJqiK3R67i/k7uOlWGeNL+5dJAG6AqpfN4Vghd8d0863Bf0U4x gusDEoKDXXz0/AVIFq/tDgzx7K3npHcbj4+SczvIDvDeeSsCRDYTuzeKCF8Xt+Z5 tTdBra0ROFGwTHjdtg98NPmPKe5pICb5OqjGADOwkqmIF7subcUyTphD9qsmj6+u BxVQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:message-id:mime-version:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; t=1687463779; x=1687550179; bh=sbZTjoYsB+s72 wSHwJUPLQeIDvOKgNcuRssyGhtr3Jk=; b=peG2IBGMUx2Mj1QwwJLFTwY5/PriP cDhCrtt68IrO3vmp9C3jsrdODp2+3An7jJ3N2+EeZMAG52Fk4kLz+2jLR2mRt3in AckmVi401R82HJu9odCRDL+cmj8effe8k3Jp/N1v2HiiYUTET3Dc7dIJMUzuQLeI WM3izhinra4BqkfM6y/6QCgS5KrrJ2QlQD5uGjXCAiRYYip9ZxJPDr2F+KQJhfDb tZeMNfAvvpl0AyEbm1VOpUwth3R89U9fVzWvj/lvXtyN9unkifudOqIRW08t+17F FiXxSxl4BmVHH0aHZlWKN8lKOxR1lbJz+DmoKF2GUS30XJFoDgabx8DcQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrgeeguddgudegfecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhepfffkhffvufgfgggtgfesthhqre dttderuhenucfhrhhomhepkggrtghkucghvghinhgsvghrghcuoeiirggtkhesohiflhhf ohhlihhordhorhhgqeenucggtffrrghtthgvrhhnpeffudeljedtkeehhfevieeujeeige eftefhtddujeeluefhffdvfefhfeeuvddvvdenucevlhhushhtvghrufhiiigvpedtnecu rfgrrhgrmhepmhgrihhlfhhrohhmpeiirggtkhesohiflhhfohhlihhordhorhhg X-ME-Proxy: Feedback-ID: i876146a2:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Thu, 22 Jun 2023 15:56:19 -0400 (EDT) Received-SPF: pass client-ip=66.111.4.25; envelope-from=zack@owlfolio.org; helo=out1-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:263919 Archived-At: With Emacs 28.2, this test .el file ``` ;; -*- lexical-binding: t; coding: utf-8 -*- (declare-function ansi-color-apply-on-region "ansi-color" (begin end &optional preserve-sequences)) (autoload 'ansi-color-apply-on-region "ansi-color") (eval-when-compile (check-declare-file byte-compile-current-file)) (defun zw-colorize-compilation-buffer () "Interpret ANSI color escapes in a compilation-mode buffer, which gets them out of the way of the error detector. Intended for use via compilation-filter-hook." (interactive) (let ((inhibit-read-only t)) (ansi-color-apply-on-region (point-min) (point-max)))) ``` provokes a byte compilation warning: ``` $ emacs -Q --batch -f batch-byte-compile test.el uncompressing ansi-color.el.gz... uncompressing ansi-color.el.gz...done In end of data: test.el:16:6: Warning: the function =A1ansi-color-apply-on-region=A2 might = not be defined at runtime. ``` The combination of `declare-function` and `autoload` is intended to ensure both that the byte compiler understands what=A2s going on, and that `ansi-color-apply-on-region` really is guaranteed to be available at runtime. Also, I triple-checked that ansi-color.el really does define this function. Why is the compiler still complaining? Analogous constructs work as expected for other functions that might not yet be loaded when their caller is evaluated, e.g. this very similar test file ``` ;; -*- lexical-binding: t; coding: utf-8 -*- (declare-function dired-get-marked-files "dired" (&optional localp arg filter distinguish-one-marked error= )) (autoload 'dired-get-marked-files "dired") (eval-when-compile (check-declare-file byte-compile-current-file)) (defun zw-dired-find-marked-files (&optional arg) "Open each of the marked files, or the file under the point, or with prefix arg, the next N files." (interactive "P") (mapc 'find-file (dired-get-marked-files nil arg))) ``` byte compiles without complaint. zw --- In GNU Emacs 28.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.37, cair= o version 1.16.0) Windowing system distributor 'The X.Org Foundation', version 11.0.12101007 System Description: Debian GNU/Linux 12 (bookworm) Configured using: 'configure CONFIG_SHELL=3D/gnu/store/rib9g2ig1xf3kclyl076w28parmncg4k-bash-minimal-5.= 1.16/bin/bash SHELL=3D/gnu/store/rib9g2ig1xf3kclyl076w28parmncg4k-bash-minimal-5.1.16/bi= n/bash --prefix=3D/gnu/store/gvbp7lp6yl3gsmz89kwajds2mh5179r5-emacs-28.2 --enable-fast-install --with-modules --with-cairo --with-native-compilation --disable-build-details' Configured features: ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG JSON LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND THREADS TIFF TOOLKIT_SCROLL_BARS X11 XDBE XIM XPM GTK3 ZLIB Important settings: value of $EMACSLOADPATH: /home/zack/.guix-profile/share/emacs/site-lisp:/= gnu/store/gvbp7lp6yl3gsmz89kwajds2mh5179r5-emacs-28.2/share/emacs/28.2/lisp value of $LC_COLLATE: C value of $LANG: en_US.UTF-8 locale-coding-system: utf-8-unix Major mode: Fundamental Minor modes in effect: envrc-global-mode: t envrc-mode: t doom-modeline-mode: t selectrum-prescient-mode: t prescient-persist-mode: t editorconfig-mode: t override-global-mode: t typo-global-mode: t global-whitespace-mode: t global-auto-revert-mode: t selectrum-mode: t tooltip-mode: t global-eldoc-mode: t show-paren-mode: t mouse-wheel-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t line-number-mode: t transient-mark-mode: t Load-path shadows: /home/zack/.config/emacs/elpa/transient-20230602.2121/transient hides /gnu/= store/gvbp7lp6yl3gsmz89kwajds2mh5179r5-emacs-28.2/share/emacs/28.2/lisp/tra= nsient /home/zack/.config/emacs/elpa/jsonrpc-1.0.17/jsonrpc hides /gnu/store/gvbp7= lp6yl3gsmz89kwajds2mh5179r5-emacs-28.2/share/emacs/28.2/lisp/jsonrpc /home/zack/.config/emacs/elpa/xref-1.6.3/xref hides /gnu/store/gvbp7lp6yl3g= smz89kwajds2mh5179r5-emacs-28.2/share/emacs/28.2/lisp/progmodes/xref /home/zack/.config/emacs/elpa/project-0.9.8/project hides /gnu/store/gvbp7l= p6yl3gsmz89kwajds2mh5179r5-emacs-28.2/share/emacs/28.2/lisp/progmodes/proje= ct /home/zack/.config/emacs/elpa/flim-20230205.1423/sasl hides /gnu/store/gvbp= 7lp6yl3gsmz89kwajds2mh5179r5-emacs-28.2/share/emacs/28.2/lisp/net/sasl /home/zack/.config/emacs/elpa/eldoc-1.14.0/eldoc hides /gnu/store/gvbp7lp6y= l3gsmz89kwajds2mh5179r5-emacs-28.2/share/emacs/28.2/lisp/emacs-lisp/eldoc Features: (shadow flyspell ispell modb-legacy modb-standard elmo-passwd gnutls network-stream nsm utf-7 elmo-imap4 time-stamp zw-wl-customization wl-fldmgr wl-template wl-demo wl-thread wl-action wl wl-draft wl-folder elmo-nntp elmo-filter wl-summary wl-refile wl-message wl-mime mime-play filename wl-e21 wl-highlight elmo-mime mmelmo-buffer mmelmo-imap mmimap mmbuffer mmgeneric wl-address wl-util pp wl-vars wl-version elmo-net elmo-cache elmo-map elmo-dop modb-generic elmo-flag elmo-localdir elmo elmo-signal elmo-msgdb modb modb-entity elmo-date elmo-util elmo-vars elmo-version mime-edit mime-image mime-view mime-conf calist invisible inv-23 mime-setup mail-mime-setup semi-setup advice semi-def mime-parse mime luna eword-encode eword-decode mel path-util pces pces-e20 pces-20 mime-def alist mcs-e20 mcs-20 wid-edit mcharset std11 pccl pccl-20 broken static apel-ver product timezone emacsbug message rmc puny dired dired-loaddefs rfc822 mml mml-sec epa derived epg rfc6068 epg-config gnus-util rmail rmail-loaddefs time-date mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils face-remap pulse envrc inheritenv ansi-color server all-the-icons all-the-icons-faces data-material data-weathericons data-octicons data-fileicons data-faicons data-alltheicons doom-modeline doom-modeline-segments doom-modeline-env doom-modeline-core shrink-path f f-shortdoc shortdoc text-property-search s dash nerd-icons nerd-icons-faces nerd-icons-data nerd-icons-data-mdicon nerd-icons-data-flicon nerd-icons-data-codicon nerd-icons-data-devicon nerd-icons-data-sucicon nerd-icons-data-wicon nerd-icons-data-faicon nerd-icons-data-powerline nerd-icons-data-octicon nerd-icons-data-pomicon nerd-icons-data-ipsicon compat compat-29 edmacro kmacro selectrum-prescient selectrum minibuf-eldef crm prescient char-fold comp comp-cstr warnings editorconfig editorconfig-core editorconfig-core-handle editorconfig-fnmatch pcase solarized-light-theme solarized-palettes solarized solarized-faces color zw-functions use-package use-package-ensure use-package-delight use-package-diminish use-package-bind-key bind-key easy-mmode use-package-core package browse-url url url-proxy url-privacy url-expand url-methods url-history url-cookie url-domsuf url-util mailcap url-handlers url-parse auth-source cl-seq eieio eieio-core cl-macs eieio-loaddefs password-cache json subr-x map url-vars cl-extra help-mode typo whitespace autorevert filenotify cl-loaddefs cl-lib cus-load guix-emacs seq byte-opt gv bytecomp byte-compile cconv info rx iso-transl tooltip eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel term/x-win x-win term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list replace newcomment text-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors frame minibuffer cl-generic cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese composite emoji-zwj charscript charprop case-table epa-hook jka-cmpr-hook help simple abbrev obarray cl-preloaded nadvice button loaddefs faces cus-face macroexp files window text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote threads dbusbind inotify lcms2 dynamic-setting system-font-setting font-render-setting cairo move-toolbar gtk x-toolkit x multi-tty make-network-process native-compile emacs) Memory information: ((conses 16 326012 10065) (symbols 48 22124 7) (strings 32 100305 5994) (string-bytes 1 2514246) (vectors 16 38478) (vector-slots 8 876336 24689) (floats 8 741 311) (intervals 56 365 0) (buffers 992 10))