Subject: Re: bug#36145: 26.2; Unable to "trigger another backtrace"

From: Noam Postavsky <[email-masked]>
Date: Sun, 09 Jun 2019 08:19:39 -0400

Xu Chunyang <[email-masked]> writes:

> (info "(elisp) Using Debugger") says
>
>> When the debugger has been entered, the ‘debug-on-error’ variable is
>> temporarily set according to ‘eval-expression-debug-on-error’.  If the
>> latter variable is non-‘nil’, ‘debug-on-error’ will temporarily be set
>> to ‘t’.  This means that any further errors that occur while doing a
>> debugging session will (by default) trigger another backtrace.
>
> Text before "This means.." is correct, but the conclusion seems
> incorrect, to reproduce
>
> - emacs -Q
> - M-: (/ 1 0)     ;; enter the debugger
> - M-: (/ 2 0)     ;; just message the error, no another backtrace
>
> Am I misunderstanding "trigger another backtrace"?

I think this is a documentation bug.  You don't get another backtrace
because inhibit-debugger is bound to t before invoking the debugger.
This has been the case since Emacs 24.3 when inhibit-debugger was
introduced [1: 45b82ad0eb].

But even before that, debug-on-error was in fact bound to nil when
entering the debugger (and that has been the case since the initial
revision of debug.el), so the documentation was always wrong (although
it looks like you could trigger another backtrace with M-: because
eval-expression would rebind debug-on-error according to
eval-expression-debug-on-error, so the conclusion used to be correct,
even though the explanation was always wrong).

[1: 45b82ad0eb]: 2012-09-11 20:14:50 -0400
  * src/eval.c: Add `inhibit-debugger'.
  https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=45b82ad0ebedaa1b7094912e218bea1510c33feb