From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: byte-compile-warn in do-after-load-evaluation - a bug? Date: Fri, 21 Jan 2022 13:39:26 -0500 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="8609"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: emacs-devel@gnu.org To: Alan Mackenzie Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Jan 21 19:51:29 2022 Return-path: Envelope-to: ged-emacs-devel@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 1nAz0T-000252-98 for ged-emacs-devel@m.gmane-mx.org; Fri, 21 Jan 2022 19:51:29 +0100 Original-Received: from localhost ([::1]:45222 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nAz0P-0007wW-GM for ged-emacs-devel@m.gmane-mx.org; Fri, 21 Jan 2022 13:51:27 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:34130) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nAypB-0005JV-Vq for emacs-devel@gnu.org; Fri, 21 Jan 2022 13:39:51 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:26233) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nAyp4-0005Sv-7x for emacs-devel@gnu.org; Fri, 21 Jan 2022 13:39:44 -0500 Original-Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 30B20805CC; Fri, 21 Jan 2022 13:39:36 -0500 (EST) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 790B4801FE; Fri, 21 Jan 2022 13:39:34 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1642790374; bh=hNWl9DhKr6ar2bpduo2Sb38c+dxOKP4JF9OD7BFT1N0=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=UilM+wkuucDQbeY4YKbc+uiuEo8u3CDWj21ZyBAVasfLi8DW8SYp5jIRVr+qtUq7T vKyuIVHQxvpKXx06dmgBXHKyjHaV/CyZDxHOFHHGUQM9gxEGkZ+Hiyw7KWudZ6d5Cg gnab6lRtcqCyoArfbk0ZMoVAbRcefcX3/Feer9xubhCRZ46Expg8ftSHAD7Qek92yG Xv1XSJkpo061SNvJ7rkCI0BCLa4O+2omjhNKMqxeNZwU6s9y6Wx45GO5popy5IjWkH raoXmdkXxv0VtyxcHHQmcuCyYI7cYJkIEGTpGCL6Su5f///qfd+8h/cIV4ELUFh7Qv NPTcM0bygBJkA== Original-Received: from alfajor (lechon.iro.umontreal.ca [132.204.27.242]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id F40C3120744; Fri, 21 Jan 2022 13:39:33 -0500 (EST) In-Reply-To: (Alan Mackenzie's message of "Fri, 21 Jan 2022 17:28:39 +0000") Received-SPF: pass client-ip=132.204.25.50; envelope-from=monnier@iro.umontreal.ca; helo=mailscanner.iro.umontreal.ca X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:285153 Archived-At: > Might it be that somebody not having a good day just used that function > thinking it was a general purpose warning function? No, and I think the code makes it pretty clear: [...] (cond ((bound-and-true-p byte-compile-current-file) ;; Don't warn about obsolete files using other obsolete files. (unless (and (stringp byte-compile-current-file) (string-match-p "/obsolete/[^/]*\\'" (expand-file-name byte-compile-current-file byte-compile-root-dir))) (byte-compile-warn "%s" msg))) [...] The intention is to use this code when the load was performed by the byte-compiler (presumably because of a `require`). > The problem with it is that it uses an implicit (compilation) source > position in the message it outputs. There is no compilation going on at > the moment. I suspect that what we should do here is to make the byte-compiler provide more info. E.g. instead of just testing `byte-compile-current-file`, which is a kind of "accidental" info, we should have `bytecomp.el` do a (let ((byte-compile-triggered-load-source )) ...) so `do-after-load-evaluation` can check this specific var and use its info to provide proper source information. WDYT? Stefan