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

From: Štěpán Němec <[email-masked]>
Date: Sun, 13 Aug 2023 12:03:41 +0200

On Sun, 13 Aug 2023 12:49:42 +0300
Eli Zaretskii wrote:

>> Cc: Stefan Monnier <[email-masked]>
>> From: Štěpán Němec
>>  <[email-masked]>
>> Date: Sun, 13 Aug 2023 09:54:29 +0200
>> 
>> 
>> sh(1) reproduction recipe:
>> 
>> --8<--
>> initdir=$(mktemp -d)
>> 
>> echo "(add-to-list 'debug-ignored-errors 'my-error)" >"$initdir"/init.el
>> emacs --debug-init --init-dir="$initdir" \
>>       --eval '(message "%S" debug-ignored-errors)'
>> 
>> rm -rf "$initdir"
>> --8<--
>> 
>> In the emacs thus started, the value of `debug-ignored-errors' is
>> "(my-error startup--witness)" instead of `my-error' added to
>> the default ignored error symbol list.
>
> I believe this is a feature:

Here's hoping it isn't.

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

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

-- 
Štěpán