]> git.eshelyaron.com Git - emacs.git/commit
debug.el: Prevent re-entering the debugger for the same error
authorStefan Monnier <monnier@iro.umontreal.ca>
Sun, 17 Mar 2024 03:10:48 +0000 (23:10 -0400)
committerEshel Yaron <me@eshelyaron.com>
Mon, 18 Mar 2024 15:44:03 +0000 (16:44 +0100)
commit0ca017711c7b7535c621ce960b61c7a1be6cbaad
treefd615292ee6cc5a8f8af106671132630e2476aad
parent93574c20d5cf8d9be207639abd7b4de1c357c74b
debug.el: Prevent re-entering the debugger for the same error

We can have several active `handler-bind`s that all want to invoke the
debugger, in which case we can have the following sequence:

- The more deeply nested handler calls the debugger.
- After a while the user invokes `debugger-continue`.
- `signal_or_quit` propagates the error up the stack to the
  second handler, which calls the debugger again.
- The user thus ends up right back at the same place, as if
  `debugger-continue` had not be processed.

Fix this by remembering the last processed error and skipping
the debugger if we bump into it again.

* lisp/emacs-lisp/debug.el (debugger--last-error): New var.
(debugger--duplicate-p): New function.
(debug): Use them.

(cherry picked from commit 445e2499baa1b8ef21e8edcc13692b5d78912922)
lisp/emacs-lisp/debug.el