Subject: Re: bug#67196: M-: uses a wrong value of debug-on-error when it is nil.

From: Alan Mackenzie <[email-masked]>
Date: Sat, 25 Nov 2023 14:14:59 +0000

Hello, Eli.

On Sat, Nov 25, 2023 at 15:04:08 +0200, Eli Zaretskii wrote:
> > Date: Sat, 25 Nov 2023 12:40:03 +0000
> > Cc: [email-masked], [email-masked], [email-masked]
> > From: Alan Mackenzie <[email-masked]>

[ .... ]

> > > Note that (AFAIU) your change doesn't just solve the problem you
> > > bumped into, it also changes the value of debug-on-error inside
> > > eval-expression etc., when eval-expression-debug-on-error's value is
> > > non-nil, but not t.  I wonder what is the reason for that?

> > I don't see that in my current version of the patch (below).  To test
> > this, I used the following:

> > (defun foo ()
> >   (interactive)
> >   (message "debug-on-error is %s" debug-on-error)
> >   (message "eval-expression-debug-on-error is %s" eval-expression-debug-on-error)
> >   (car 'foo))

> > , and called it with various settings of debug-on-error and
> > eval-expression-debug-on-error.  In particular, with

> >   (setq eval-expression-debug-on-error '(wrong-type-argument))

> > , I still see debug-on-error reported as nil.

> No, I meant with the current code debug-on-error is set to t whenever
> eval-expression-debug-on-error is non-nil, ....

Yes.

> .... and your change sets it to the same value as
> eval-expression-debug-on-error instead.

That is not what is meant to happen.  Instead, the new internal variable
debug-from--eval-expression gets set to e-e-debug-on-error.
debug-on-error should remain unchanged throughout a M-: call, leaving it
free for use by user code.  The subroutines of signal_or_quit test
debug-from--eval-expression in addition to testing debug-on-error.

Are you sure that isn't what you're seeing?

-- 
Alan Mackenzie (Nuremberg, Germany).