From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#66912: With `require', the byte compiler reports the wrong file for errors. Date: Sun, 12 Nov 2023 12:28:13 -0500 Message-ID: References: Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="19178"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 66912@debbugs.gnu.org To: Alan Mackenzie Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Nov 12 18:29:47 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 1r2EHK-0004ku-6i for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 12 Nov 2023 18:29:46 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r2EGy-0000rK-Qe; Sun, 12 Nov 2023 12:29:24 -0500 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 1r2EGv-0000r5-TG for bug-gnu-emacs@gnu.org; Sun, 12 Nov 2023 12:29:22 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r2EGv-0001ig-LR for bug-gnu-emacs@gnu.org; Sun, 12 Nov 2023 12:29:21 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1r2EHa-00048c-Jk for bug-gnu-emacs@gnu.org; Sun, 12 Nov 2023 12:30:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 12 Nov 2023 17:30:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 66912 X-GNU-PR-Package: emacs Original-Received: via spool by 66912-submit@debbugs.gnu.org id=B66912.169981014615812 (code B ref 66912); Sun, 12 Nov 2023 17:30:02 +0000 Original-Received: (at 66912) by debbugs.gnu.org; 12 Nov 2023 17:29:06 +0000 Original-Received: from localhost ([127.0.0.1]:56935 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r2EGf-00046y-GL for submit@debbugs.gnu.org; Sun, 12 Nov 2023 12:29:05 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:55654) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r2EGc-00046T-M1 for 66912@debbugs.gnu.org; Sun, 12 Nov 2023 12:29:03 -0500 Original-Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 71B7A440F8F; Sun, 12 Nov 2023 12:28:15 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1699810094; bh=oMxo46cC9EC8dVmEb9V+3QevSy1tIzmJu98udgvDfsc=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=RPmTIrvM6wG79IANkgKHAWpDHSRFvjrVtghQ/VAcJBvGFyOrtZbMBABoy3BfzG22K x61wk3PWYKSvEzwE0X40XBR5rSXI/UbaYimzy2qY8xu+bNOK7F2Az1P+Hk/E0kRHhU oZ2JuDcKNroILL5B2FohlEpcPTgDiDW1Bwm664hWKU8TRdVppZgUtsFFOBxMUYHdIW c01iK78M8umg23+NLYfwgui03jV4AQSxpSRd8PZ+2MDi645fstJiirJ7Fe0mMBp+M5 cDqoohqHCrExIPKdXQ2tnzaULCuXD3GTIQFtT94BcgA9PPI1+/p4g728aWPxepyW0B 4D2Nfz6fRLGSw== Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 156A3440A25; Sun, 12 Nov 2023 12:28:14 -0500 (EST) Original-Received: from pastel (unknown [45.72.227.120]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id E0D96120388; Sun, 12 Nov 2023 12:28:13 -0500 (EST) In-Reply-To: (Alan Mackenzie's message of "Sun, 12 Nov 2023 16:30:06 +0000") 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:274214 Archived-At: > Why not? We're not in the compilation any more, we're loading a file. > Some error has prevented that file loading, so we want a backtrace just > as we would get with M-x load-file foo.elc RET. Hmm... that's a good point. >> I think for this specific problem being discussed (which is indeed >> a fairly common occurrence in my experience), the better solution is to >> change `load` so it adds the "context" (i.e. filename and ideally also >> the approximate file position info) to errors. >> [ This may require something like `handler-bind`. ] > Another solution would be to dispense with > display-byte-compile-warnings, just letting compiler errors generate > backtraces. > > The problem here is that there is no distinction in bytecomp.el between > "external" errors (such as from require) and errors detected by the > compiler in the source file being compiled. These are two fairly "clear" cases, admittedly. But there are also cases in between where it's less clear, mostly with errors during macro-expansion where the internal/external distinction is not always that clear since some macros come from outside but others come from the very file we're compiling, and where we can't easily tell if an error is due to a bug in the macro definition or a bug in the use of the macro. > The first decidedly want a backtrace, the second probably not. > All these errors are handled as though they were "internal" errors > detected by the compiler. This is suboptimal. Also there are 2 questions: - whether to give a backtrace (and/or enter the debugger). - when we don't show a backtrace, what info do we put in the error message. For the first, the current "solution" is to set `byte-compile-debug`. It's not ideal, and we should improve it, but at least we do have a solution for it. For the second we currently don't show a good enough info and in my previous response I focused on that part. > Perhaps we should report the second type of error (detected by the > compiler) by calling a warning function, as we do for warnings, and > removing the damaging condition-case's as suggested two paragraphs back. If the user is not asking to see backtraces, the current treatment seems cleaner than without any `condition-case`. So maybe those `condition-case` should be turned into `condition-case-unless-debug`? Stefan