[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Maybe the debugger should not ignore read errors
From: |
Spencer Baugh |
Subject: |
Re: Maybe the debugger should not ignore read errors |
Date: |
Wed, 17 Jan 2024 15:04:38 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
Eli Zaretskii <eliz@gnu.org> writes:
>> From: Spencer Baugh <sbaugh@janestreet.com>
>> Date: Wed, 17 Jan 2024 13:51:03 -0500
>>
>>
>> If you read a file with a syntax error with debug-on-error=t, e.g.:
>>
>> (let ((debug-on-error t)) (read ""))
>>
>> Emacs will not drop to the debugger. Instead, the error "End of file
>> during parsing" will just be printed. This is because
>> debug-ignored-errors includes end-of-file, which is what read signals on
>> error.
>>
>> This in turn means that --debug-init will not cause Emacs to drop to the
>> debugger if there's a read error in some file at load time, which can
>> happen in many ways. For example, some state file such as created by
>> project.el or savehist.el might get corrupted one way or another.
>>
>> This seems unnecessarily hostile to novice Emacs users who only know
>> that --debug-init seems to do nothing when faced with this kind of
>> error. Certainly they have no idea that debug-ignored-errors even
>> exists.
>
> No, when Emacs is invoked with --debug-init, we reset
> debug-ignored-errors to nil while the init file is loaded. This was
> done as part of fixing bug#64163, so if you see this now on master, it
> is some kind of regression, perhaps due to recent changes related to
> handler-bind.
Oh, that's great! I didn't test the --debug-init part with master, so I
missed that this had changed. That mostly resolves my concern, then.
>> Should we remove end-of-file from debug-ignored-errors?
>
> No, I don't think so. The problem with debugging the init files is
> supposed to be solved (if that broke, we need to fix it), and other
> than that I don't see a reason to change this age-old behavior.
> Please keep in mind that end-of-file frequently happens when users
> type expressions at the M-: prompt and make syntax mistakes; we don't
> want to pop up the debugger in that case (and other similar ones).
>
>> end-of-file is not like the other errors in debug-ignored-errors,
>> which are all user-errors.
>
> Actually, end-of-file is frequently a cockpit error, see above.
That's a good point, it would be annoying to drop to the debugger in
that case.
(So then I'll just fix the related bug#68546 to improve the error
message, and I'll be happy)