emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] emacs-25 eb364fd: Do call debugger on failed cl-assert


From: Noam Postavsky
Subject: [Emacs-diffs] emacs-25 eb364fd: Do call debugger on failed cl-assert
Date: Wed, 9 Nov 2016 00:53:33 +0000 (UTC)

branch: emacs-25
commit eb364fddec1431f459166cebb36f09f6b371dd71
Author: Noam Postavsky <address@hidden>
Commit: Noam Postavsky <address@hidden>

    Do call debugger on failed cl-assert
    
    "Don't call debug on failed cl-assert..." removed the call to `debug' in
    cl--assertion-failed because `debug' calls `kill-emacs' in batch mode,
    thus messing up ert test runs.  However, calling the debugger is useful
    because it allows catching failed assertions even inside
    `condition-case' calls.  The problem with ert can be avoided by calling
    `debugger' instead of `debug' directly, since ert installs its own
    debugger while running tests.
    
    * lisp/emacs-lisp/cl-preloaded.el (cl--assertion-failed): Call
    `debugger' if `debug-on-error' is non-nil.
---
 lisp/emacs-lisp/cl-preloaded.el |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/lisp/emacs-lisp/cl-preloaded.el b/lisp/emacs-lisp/cl-preloaded.el
index 639ffa6..2b022c4 100644
--- a/lisp/emacs-lisp/cl-preloaded.el
+++ b/lisp/emacs-lisp/cl-preloaded.el
@@ -44,9 +44,11 @@
 (define-error 'cl-assertion-failed (purecopy "Assertion failed"))
 
 (defun cl--assertion-failed (form &optional string sargs args)
-  (if string
-      (apply #'error string (append sargs args))
-    (signal 'cl-assertion-failed `(,form ,@sargs))))
+  (if debug-on-error
+      (funcall debugger `(cl-assertion-failed ,form ,string ,@sargs))
+    (if string
+        (apply #'error string (append sargs args))
+      (signal 'cl-assertion-failed `(,form ,@sargs)))))
 
 ;; When we load this (compiled) file during pre-loading, the cl--struct-class
 ;; code below will need to access the `cl-struct' info, since it's considered



reply via email to

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