[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
scratch/handler-bind 7da237eb092 03/12: edebug.el: Use `handler-bind` in
From: |
Stefan Monnier |
Subject: |
scratch/handler-bind 7da237eb092 03/12: edebug.el: Use `handler-bind` instead of `signal-hook-function` |
Date: |
Mon, 25 Dec 2023 23:56:51 -0500 (EST) |
branch: scratch/handler-bind
commit 7da237eb09284771dca953b81d7b0f6ad7617e75
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>
edebug.el: Use `handler-bind` instead of `signal-hook-function`
* lisp/emacs-lisp/edebug.el (edebug-signal): Adjust to new
calling convention.
(edebug-default-enter): Use `handler-bind` instead of
`signal-hook-function`.
(edebug--recursive-edit): Simplify accordingly.
---
lisp/emacs-lisp/edebug.el | 24 ++++++++----------------
1 file changed, 8 insertions(+), 16 deletions(-)
diff --git a/lisp/emacs-lisp/edebug.el b/lisp/emacs-lisp/edebug.el
index aa68978f6d6..2a1851dee58 100644
--- a/lisp/emacs-lisp/edebug.el
+++ b/lisp/emacs-lisp/edebug.el
@@ -2261,8 +2261,8 @@ are too difficult to instrument")
;;; Handling signals
-(defun edebug-signal (signal-name signal-data)
- "Signal an error. Args are SIGNAL-NAME, and associated DATA.
+(defun edebug-signal (err)
+ "Signal an error. ERR is the list made of the signal name and its data.
A signal name is a symbol with an `error-conditions' property
that is a list of condition names.
A handler for any of those names will get to handle this signal.
@@ -2272,17 +2272,12 @@ DATA should be a list. Its elements are printed as
part of the error message.
If the signal is handled, DATA is made available to the handler.
See `condition-case'.
-This is the Edebug replacement for the standard `signal'. It should
-only be active while Edebug is. It checks `debug-on-error' to see
+This is the error handler installed during Edebug.
+It should only be active while Edebug is. It checks `debug-on-error' to see
whether it should call the debugger. When execution is resumed, the
-error is signaled again."
- (if (and (listp debug-on-error) (memq signal-name debug-on-error))
- (edebug 'error (cons signal-name signal-data)))
- ;; If we reach here without another non-local exit, then send signal again.
- ;; i.e. the signal is not continuable, yet.
- ;; Avoid infinite recursion.
- (let ((signal-hook-function nil))
- (signal signal-name signal-data)))
+error is propagated further."
+ (if (and (listp debug-on-error) (memq (car err) debug-on-error))
+ (edebug 'error err)))
;;; Entering Edebug
@@ -2326,7 +2321,7 @@ and run its entry function, and set up `edebug-before' and
(debug-on-error (or debug-on-error edebug-on-error))
(debug-on-quit edebug-on-quit))
(unwind-protect
- (let ((signal-hook-function #'edebug-signal))
+ (handler-bind ((error #'edebug-signal))
(setq edebug-execution-mode (or edebug-next-execution-mode
edebug-initial-mode
edebug-execution-mode)
@@ -2937,14 +2932,11 @@ when edebug becomes active."
(not (memq arg-mode '(after error))))
(message "Break"))
- (setq signal-hook-function nil)
-
(edebug-mode 1)
(unwind-protect
(recursive-edit) ; <<<<<<<<<< Recursive edit
;; Do the following, even if quit occurs.
- (setq signal-hook-function #'edebug-signal)
(if edebug-backtrace-buffer
(kill-buffer edebug-backtrace-buffer))
- branch scratch/handler-bind created (now 933bc573c60), Stefan Monnier, 2023/12/25
- scratch/handler-bind 23479891db8 01/12: New special form `handler-bind`, Stefan Monnier, 2023/12/25
- scratch/handler-bind 7da237eb092 03/12: edebug.el: Use `handler-bind` instead of `signal-hook-function`,
Stefan Monnier <=
- scratch/handler-bind 089c87c61db 02/12: (eval-expression): Fix bug#67196, Stefan Monnier, 2023/12/25
- scratch/handler-bind a97a2363e39 04/12: ert.el: Use `handler-bind` to record backtraces, Stefan Monnier, 2023/12/25
- scratch/handler-bind 8f090cd421d 05/12: tramp.el: Use `handler-bind` instead of `signal-hook-function`, Stefan Monnier, 2023/12/25
- scratch/handler-bind 2f6f38ddc79 07/12: Move batch backtrace code to `top_level_2`, Stefan Monnier, 2023/12/25
- scratch/handler-bind e7c19f33112 09/12: (edebug-format): Make it obsolete, Stefan Monnier, 2023/12/25
- scratch/handler-bind 071ea552e6b 10/12: Add `redisplay-counter` to catched nested redisplays and abort outer one, Stefan Monnier, 2023/12/25
- scratch/handler-bind 68c95fc6682 06/12: startup.el: Use `handler-bind` to implement `--debug-init`, Stefan Monnier, 2023/12/25
- scratch/handler-bind 1fcb76b0465 08/12: Allow the `error-message` property to be a function, Stefan Monnier, 2023/12/25
- scratch/handler-bind 453f977d642 11/12: misc debug-early.el (incl. debug-early-muted), Stefan Monnier, 2023/12/25
- scratch/handler-bind 933bc573c60 12/12: (macroexp--with-extended-form-stack): Use plain `let`, Stefan Monnier, 2023/12/25