emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: master 4302bc9b0f1: Allow --debug-init to debug all errors in init f


From: Stefan Monnier
Subject: Re: master 4302bc9b0f1: Allow --debug-init to debug all errors in init files
Date: Mon, 26 Jun 2023 09:57:08 -0400
User-agent: Gnus/5.13 (Gnus v5.13)

>> > -          (load (if (equal (file-name-extension init-file-name)
>> > -                           "el")
>> > -                    (file-name-sans-extension init-file-name)
>> > -                  init-file-name)
>> > -                'noerror 'nomessage))
>> > +                ;; If they specified --debug-init, enter the debugger
>> > +                ;; on any error whatsoever.
>> > +                (let ((debug-ignored-errors
>> > +                       (if (and init-file-debug (not noninteractive))
>> > +                           nil
>> > +                         debug-ignored-errors)))
>> > +            (load (if (equal (file-name-extension init-file-name)
>> > +                             "el")
>> > +                      (file-name-sans-extension init-file-name)
>> > +                    init-file-name)
>> > +                  'noerror 'nomessage)))
>> 
>> Now the changes I make to `debug-ignored-errors` in my `init.el` are
>> thrown away :-(
>
> They are?  AFAIU, the code only overrides the value of
> debug-ignored-errors if Emacs was invoked with --debug-init, and
> otherwise honors whatever value you set in your init files.  Or what
> am I missing?

There's a let-binding of `debug-ignored-errors` around the `load`, so
the old value is restored when we finish `load` :-(

That's what the `startup` value in `debug-on-error` is about (which
I changed to `startup--witness` in my patch to try and make it more
clear): to detect when init files changed the value and then be careful
to preserve this new value when we exit the `let`.

BTW, another difference is that you seem to have that offending code in
3 places whereas the setting of `debug-on-error` happens only once
(which is why I put my code alongside that setting rather than around
each and every `load`).


        Stefan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]