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: Thu, 17 Aug 2023 16:16:19 +0200

On Thu, 17 Aug 2023 16:28:31 +0300
Eli Zaretskii wrote:

>> From: Stefan Monnier <[email-masked]>
>> Cc: [email-masked],  [email-masked],  [email-masked]
>> Date: Thu, 17 Aug 2023 08:55:38 -0400
>> 
>> > What about the minor changes below?  They do seem to yield the
>> > expected results in the original recipe.  The idea is to detect the
>> > situation where the init file _added_ to the value of
>> > debug-ignored-errors, and re-add the additions after loading the init
>> > file.
>> 
>> No objection from me (it's not great, but I don't think there's a great
>> solution).
>
> Thanks.
>
> Štěpán, would you mind testing the patch?  If it works for you, I will
> install it.

Your patch preserves additions (although it moves them to the end of the
list, but that shouldn't matter for debug-ignored-errors), but doesn't
preserve removals, e.g., if we change the reproducer from my original
report to

--8<--
initdir=$(mktemp -d)

#echo "(add-to-list 'debug-ignored-errors 'my-error)" >"$initdir"/init.el
echo "(setq debug-ignored-errors (delq 'end-of-file debug-ignored-errors))" >"$initdir"/init.el
emacs --debug-init --init-dir="$initdir" \
      --eval '(message "%S" debug-ignored-errors)'

rm -rf "$initdir"
--8<--

we end up with debug-ignored-errors containing `end-of-file' (together
with the rest).

Have you considered my humble suggestion of reverting to pre-bug#64163
state and simply removing end-of-file from the default value of
debug-ignored-errors?

-- 
Štěpán