unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: 74294@debbugs.gnu.org
Cc: Stefan Monnier <monnier@iro.umontreal.ca>
Subject: bug#74294: Master: debug-on-error is ineffective whilst requiring a file from the byte compiler.
Date: Sun, 10 Nov 2024 13:05:36 +0000	[thread overview]
Message-ID: <ZzCvoEewfYAUy73l@MAC.fritz.box> (raw)

Hello, Emacs.

In master (any recent version):

Create the following files:

1: ~/test-byte-compile-errors.el:
#########################################################################
;; -*- lexical-binding:t -*-
(require 'test-byte-compile-errors-2 "~/test-byte-compile-errors-2")
#########################################################################

2: ~/test-byte-compile-errors-2.el:
#########################################################################
;; -*- lexical-binding:t -*-
(car 'baz)

(provide 'test-byte-compile-errors-2)
#########################################################################

(Note the erroneous (car 'baz) in this file.)

(i) emacs -Q
(ii) M-: (setq debug-on-error t) RET
(iii) M-x byte-compile-file RET ~/test-byte-compile-errors.el RET

(iv) The error message:

    test-byte-compile-errors.el:2:11: Error: Wrong type argument: listp, baz

is displayed.  The debugger is not run.  This is surely a bug.

(Note also, the file name displayed is not that where the error is: See
bug#66912.)

#########################################################################

Diagnosis
---------

In the function bytecomp--displaying-warnings (bytecomp.el), a blocking
condition-case is set up, except when byte-compile-debug is non-nil.
This prevents the debugger running.  The problem is, the effect of this
condition-case prevails even outside the byte compiler whilst loading a
file with `require'.

#########################################################################

Proposed Resolution
-------------------

Set up one or more handler-binds around the parts of Fload that evaluate
the contents of the file being loaded.  In the event of an error, the
handler-bind handler would trigger, test debug-on-error, and if it's set
appropriately, call the debugger, then quit.  Otherwise, the handler
would return, and the error handling would eventually reach the
condition-case set up by bytecomp--displaying-warnings.

-- 
Alan Mackenzie (Nuremberg, Germany).





             reply	other threads:[~2024-11-10 13:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-10 13:05 Alan Mackenzie [this message]
2024-11-10 17:31 ` bug#74294: Master: debug-on-error is ineffective whilst requiring a file from the byte compiler Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-10 18:38   ` Alan Mackenzie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZzCvoEewfYAUy73l@MAC.fritz.box \
    --to=acm@muc.de \
    --cc=74294@debbugs.gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).