unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: master 4302bc9b0f1: Allow --debug-init to debug all errors in init files
Date: Mon, 26 Jun 2023 09:57:08 -0400	[thread overview]
Message-ID: <jwv4jmumiu7.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <83bkh2xz1h.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 26 Jun 2023 14:07:06 +0300")

>> > -		(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	other threads:[~2023-06-26 13:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <168735410313.21082.15347717294570895563@vcs2.savannah.gnu.org>
     [not found] ` <20230621132823.6C945C06C79@vcs2.savannah.gnu.org>
2023-06-25 23:26   ` master 4302bc9b0f1: Allow --debug-init to debug all errors in init files Stefan Monnier
2023-06-26 11:07     ` Eli Zaretskii
2023-06-26 13:57       ` Stefan Monnier [this message]
2023-06-26 14:27         ` Stefan Monnier
2023-06-26 14:52           ` Eli Zaretskii
2023-06-26 15:25             ` Stefan Monnier
2023-06-26 14:48         ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwv4jmumiu7.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).