Subject: bug#65267: 30.0.50; modifying debug-ignored-errors during startup with --debug-init is broken

From: Eli Zaretskii <[email-masked]>
Date: Sun, 13 Aug 2023 13:12:56 +0300

> From: Štěpán Němec <[email-masked]>
> Cc: [email-masked], [email-masked]
> Date: Sun, 13 Aug 2023 12:03:41 +0200
> 
> On Sun, 13 Aug 2023 12:49:42 +0300
> Eli Zaretskii wrote:
> 
> > when the user says --debug-init, they need to be shown all the errors
> > raised during startup; hiding some of the errors was a misfeature in
> > previous versions of Emacs, now fixed.
> 
> That would seem OK to me.  The problem is that, as it is now, this
> breaks normal Emacs usage of anyone who starts with --debug-init and
> happens to modify `debug-ignored-errors' as part of their
> initialization.

You are not supposed to suppress errors during startup when you use
the --debug-init switch.  You are supposed to resolve the errors one
by one, until no errors are left.  (Resolving errors could include
catching them and ignoring them, e.g., with the likes of
ignore-errors.)  That's what --debug-init is for, so leaving some
errors suppressed in that case makes no sense.  Moreover, most users
don't even know that debug-ignored-errors exists and has a non-nil
value by default, so the effect is to hide some errors during startup
from those users -- and that is the anti-thesis of --debug-init.

> Note that it might not even be user-intentional/explicit modification,
> e.g., I noticed the problem because I load yasnippet from my init file,
> and yasnippet adds a custom regexp to debug-ignored-errors; so now I end
> up with bogus debug-ignored-errors value, which is further aggravated by
> the fact that I normally run with debug-on-errors set, so, for example,
> I now end up in the debugger whenever I press C-n at the end of buffer
> (until I manually restore debug-ignored-errors to a sane value).

The above works perfectly okay as long as --debug-init is not used,
right?  (If it doesn't, then this is not a problem with a recent
change that is supposed to affect only --debug-init.)