From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.bugs Subject: bug#66912: With `require', the byte compiler reports the wrong file for errors. Date: Tue, 5 Nov 2024 14:54:24 +0000 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="18345"; mail-complaints-to="usenet@ciao.gmane.io" Cc: acm@muc.de, Eli Zaretskii , 66912@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Nov 05 15:55:27 2024 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 1t8Kxq-0004aT-8j for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 05 Nov 2024 15:55:26 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t8Kxb-0007W7-PY; Tue, 05 Nov 2024 09:55:11 -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 1t8KxT-0007Rh-Ep for bug-gnu-emacs@gnu.org; Tue, 05 Nov 2024 09:55:03 -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 1t8KxS-0008OM-H9 for bug-gnu-emacs@gnu.org; Tue, 05 Nov 2024 09:55:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=From:In-Reply-To:MIME-Version:References:Date:To:Subject; bh=tHbDMcB6C0Zuz1Q0TTrj1w0U6hffyu5AalyOhq3hqGw=; b=gjxkgd8MasN9aUEE6uSPW+7q1/7hGvIcjoWZznUPt30myKWDKogiFCDC0v2rM69qcD66uXx9U6Zr0wP2R6D7BudiA0HqRahwRwFqROxWEHd95R57e3S8c9Jb/huOPlCyhDni6YTyFjvTUj8A84HXYKiPqktOCU7vuLe0nWPUZvtXHVLefswY0JU4MUaoceha1Cj+qS8Mu7xrnHFmf4L4WX64yAfBtMvqKiaxct+onNcKbSf/bRhP5p1nm9YWeb+wKrvHznTfVOUeVDjyZ3p2hzhn8P1kyuNhaHjH1cB2CyGqcEpIIc4r7eIM7Fz/LQPVlyACdDtmzdtJrwcRX+vpsQ==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1t8KxS-0001gt-2e for bug-gnu-emacs@gnu.org; Tue, 05 Nov 2024 09:55:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 05 Nov 2024 14:55: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.17308184756478 (code B ref 66912); Tue, 05 Nov 2024 14:55:02 +0000 Original-Received: (at 66912) by debbugs.gnu.org; 5 Nov 2024 14:54:35 +0000 Original-Received: from localhost ([127.0.0.1]:44037 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t8Kx1-0001gQ-E0 for submit@debbugs.gnu.org; Tue, 05 Nov 2024 09:54:35 -0500 Original-Received: from mail.muc.de ([193.149.48.3]:51145) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t8Kwy-0001gI-N0 for 66912@debbugs.gnu.org; Tue, 05 Nov 2024 09:54:33 -0500 Original-Received: (qmail 42315 invoked by uid 3782); 5 Nov 2024 15:54:25 +0100 Original-Received: from muc.de (p4fe159f4.dip0.t-ipconnect.de [79.225.89.244]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Tue, 05 Nov 2024 15:54:25 +0100 Original-Received: (qmail 9400 invoked by uid 1000); 5 Nov 2024 14:54:24 -0000 Content-Disposition: inline In-Reply-To: X-Submission-Agent: TMDA/1.3.x (Ph3nix) X-Primary-Address: acm@muc.de 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:294909 Archived-At: Hello, Stefan. On Mon, Nov 04, 2024 at 22:27:00 -0500, Stefan Monnier wrote: > > Here's the amended patch. It's a lot shorter (and easier) than the > > previous version. I would like to commit it as the fix to bug#66912. > Thanks. I'm not in love with this approach, among other things because > of the problem I described earlier: > But I don't think it would be correct in all cases: if file A loads > file B which compiles file C which loads file D which signals an > error we want the compiler error message to say "error in D loaded > from C" and not "error in D loaded from C loaded from B loaded from > A". > but it's not the end of the world, so I don't object to installing it on > `master`. OK, thanks! > > static Lisp_Object Vloads_in_progress; > > +/* The same as the above, except it survives the unbinding done in the > > + event of an error, and can thus be used in error handling. */ > > +Lisp_Object Vloads_still_in_progress; > Please clarify how "it survives the unbinding". It is a global variable which never gets bound, hence when an error is signalled and the binding stack unwound, it keeps its value. But you want me to write this into the comment, not just explain it here. ;-) I've become a little uncertain about this mechanism. Should an error occur during loading, and the code somehow avoid calling prefix-load-file-names, perhaps by some obscure setting of `debugger', Vloads_still_in_progress would stay non-nil, and pollute the next error message to be output. I think the default global value of Vloads_still_in_progress should be Qnil, and I should bind it to itself each iteration of the command loop, probably in command_loop_1. That would protect it from wierd uses of recursive_edit, and avoid the need to reset Vloads_still_in_progress in prefix-load-file-names. What do you (or Eli) think? > [ BTW, a nice improvement would be to keep track of where we are in the > outer load when the start the inner load, so that the "While loading" > message can point to the place where the loading was triggered. ] I think I would agree, but this would be difficult for .el[cn] files. How about giving the line number just for .el files, something like: While loading foo.el line 42... While loading bar.elc... While loading baz.el... \n Wrong type argument: listp, baz I'm sure this wouldn't be too difficult. > Stefan -- Alan Mackenzie (Nuremberg, Germany).