emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

scratch/handler-bind-2 94b11fc0c9b 16/16: edebug.el: Use `handler-bind`


From: Stefan Monnier
Subject: scratch/handler-bind-2 94b11fc0c9b 16/16: edebug.el: Use `handler-bind` instead of `signal-hook-function`
Date: Wed, 27 Dec 2023 23:53:31 -0500 (EST)

branch: scratch/handler-bind-2
commit 94b11fc0c9bf5ab7fca2b1707925dd90c2a293ad
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 | 20 ++++++--------------
 1 file changed, 6 insertions(+), 14 deletions(-)

diff --git a/lisp/emacs-lisp/edebug.el b/lisp/emacs-lisp/edebug.el
index 412bb672627..5c5ce3747d4 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.
@@ -2275,14 +2275,9 @@ See `condition-case'.
 This is the error handler installed during Edebug.
 It should be active only 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))
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]