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: Wed, 30 Oct 2024 15:33:04 -0400 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="27866"; 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 Wed Oct 30 20:34:21 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 1t6ESS-000775-L1 for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 30 Oct 2024 20:34:20 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t6ESB-0008Q4-Vm; Wed, 30 Oct 2024 15:34:04 -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 1t6ESA-0008Pd-Ag for bug-gnu-emacs@gnu.org; Wed, 30 Oct 2024 15:34:02 -0400 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 1t6ESA-0002uZ-2K for bug-gnu-emacs@gnu.org; Wed, 30 Oct 2024 15:34:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=Apb+hBmoTO03YVi++/0jERTzS+N2T/WmEPd846MJ+U8=; b=F9qiEABmsULuigv/ZNaBURYZ7BVHcbGVKfeChQmfGXTnRNGPfMKGzlSciZNg3ra3SnOJpcsLCWEFbxEzRgWe1KiHVgK2yRzPKRcPqErbKqFRWm9z72LDewzzI7tbAbwbwz1wh6oQ+OfLH/1IVqbVS+GyJbcUpcCUEZ6BOjLH6Kt7kvQAD011Cm+oBQm624TZNPb1o11qS421l0kUiqVzWC9NGh12RZNaLGJT77qijKLkbZ2EIj2xCspucVwNnEoFTqdU8kWLck8XTQq/GOGG01Y2uHWEPrtsFGPWGR6hdYzeXEpB95TCx9IKiw9+BqMDaoznwi2/Ir38ZUuIneszGA==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1t6ES9-000696-OP for bug-gnu-emacs@gnu.org; Wed, 30 Oct 2024 15:34:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 30 Oct 2024 19:34:01 +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.173031679523596 (code B ref 66912); Wed, 30 Oct 2024 19:34:01 +0000 Original-Received: (at 66912) by debbugs.gnu.org; 30 Oct 2024 19:33:15 +0000 Original-Received: from localhost ([127.0.0.1]:37033 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t6ERP-00068W-8M for submit@debbugs.gnu.org; Wed, 30 Oct 2024 15:33:15 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:60871) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t6ERM-00068O-Mq for 66912@debbugs.gnu.org; Wed, 30 Oct 2024 15:33:13 -0400 Original-Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id F280E442856; Wed, 30 Oct 2024 15:33:05 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1730316784; bh=jXDK0QTlSaJ9zM//biyL3BA8hpfvp6Reu3D++88Z28A=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=bUDMQU33maPuQ0XhT7t8yDsJcGvSQ/T5HCCh5UFY5ELjyGAWUgThhxEG890+wi3mq bzaLkNCUYC1/JZ5CXDT+e+cCJNT+gsGQlauvk5fXAglRsFR4u8vehKWMnKbOkMZKuU STuaOY1IpamXw7mG0MbGsPlVYA+i7cVNwI9RQDXcgAEVJqRruslHK0pz34QXZDLugc 2r3Lx+eLmUcmezf7Mb0x7T/zsjxQYOUW+hIZl/UNKw0cqT3Z1+RPFozyz4t1HTjOpD ZWywoxTO/BKegn+BBlE/2yN8lNqlQE5cbn4+HqVK1r6F93jSdTORPQmurRpw30vXsD bHHGSHGPsHjGQ== Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id BB28A44285E; Wed, 30 Oct 2024 15:33:04 -0400 (EDT) Original-Received: from lechazo (lechon.iro.umontreal.ca [132.204.27.242]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 9F51112033B; Wed, 30 Oct 2024 15:33:04 -0400 (EDT) In-Reply-To: (Alan Mackenzie's message of "Tue, 29 Oct 2024 18:59:11 +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:294582 Archived-At: > year, in place of the current error output > > test-byte-compile-errors.el:2:11: Error: Wrong type argument: listp, baz > > the following line would appear: > > test-byte-compile-errors.el:2:11: While loading "test-byte-compile-errors-2.el" Error: Wrong type argument: listp, baz I can definitely live with this syntax, but maybe we should use something more like what GCC uses (e.g. for errors in #included files) which puts the "While loading" info on separate lines. > This could surely be achieved with something like the following in Fload: > > (handler-bind ((lambda (err) > (signal (car err) > (combine-error-info "While loading " file > (cdr err))))) > readevalloop (Qget_file_char, &input, hist_file_name, > 0, Qnil, Qnil, Qnil, Qnil);) That was my thinking as well (tho see below). > (where, obviously, the details need to be worked out). It would need > augmenting with handling for (eq debug-on-error t), and probably a few > other things, too. `combine-error-info` is a bit problematic because we don't have clear rules about the content of (cdr err), other than the fact that it should be a list (tho we don't even enforce that very much). Most likely we could append elements to that list, but we'd have to worry about interactions with other libraries wanting to do similar things. So I was thinking that we should go instead with: (handler-bind ((error (lambda (err) (push file (gethash err our-table-of-error-source))))) readevalloop (Qget_file_char, &input, hist_file_name, 0, Qnil, Qnil, Qnil, Qnil);) Where `our-table-of-error-source` would be a weak eq-hashtable. Emacs Lisp guarantees that the `err` we get here will be the exact same object that any subsequent `condition-case` will get when it finally handles the error so that it can use `gethash` to fetch our side information. Note that we don't `signal` the error again, instead we let the error handling code propagate it further, which is what `handler-bind` does when the handler returns normally (which should also eliminate the possible problems of interaction with `debug-on-error`). Stefan