unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Maybe the debugger should not ignore read errors
@ 2024-01-17 18:51 Spencer Baugh
  2024-01-17 19:31 ` Eli Zaretskii
  0 siblings, 1 reply; 3+ messages in thread
From: Spencer Baugh @ 2024-01-17 18:51 UTC (permalink / raw)
  To: emacs-devel


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.

Should we remove end-of-file from debug-ignored-errors?  end-of-file is
not like the other errors in debug-ignored-errors, which are all
user-errors.

That would make --debug-init and M-x toggle-debug-on-error drop to the
debugger when a read error is encountered, which seems like an
improvement.




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Maybe the debugger should not ignore read errors
  2024-01-17 18:51 Maybe the debugger should not ignore read errors Spencer Baugh
@ 2024-01-17 19:31 ` Eli Zaretskii
  2024-01-17 20:04   ` Spencer Baugh
  0 siblings, 1 reply; 3+ messages in thread
From: Eli Zaretskii @ 2024-01-17 19:31 UTC (permalink / raw)
  To: Spencer Baugh; +Cc: emacs-devel

> 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.

> 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.



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Maybe the debugger should not ignore read errors
  2024-01-17 19:31 ` Eli Zaretskii
@ 2024-01-17 20:04   ` Spencer Baugh
  0 siblings, 0 replies; 3+ messages in thread
From: Spencer Baugh @ 2024-01-17 20:04 UTC (permalink / raw)
  To: emacs-devel

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)




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-01-17 20:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-17 18:51 Maybe the debugger should not ignore read errors Spencer Baugh
2024-01-17 19:31 ` Eli Zaretskii
2024-01-17 20:04   ` Spencer Baugh

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).