summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/cl-preloaded.el
diff options
context:
space:
mode:
authorNoam Postavsky <npostavs@gmail.com>2016-11-07 20:03:48 -0500
committerNoam Postavsky <npostavs@gmail.com>2016-11-08 19:54:03 -0500
commiteb364fddec1431f459166cebb36f09f6b371dd71 (patch)
treec2815dcdf89f34108af0e9a7f075204f6ff2e8bd /lisp/emacs-lisp/cl-preloaded.el
parent3ef4ee84fa3f658c2df802569dc89023d98e9947 (diff)
downloademacs-eb364fddec1431f459166cebb36f09f6b371dd71.tar.gz
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.
Diffstat (limited to 'lisp/emacs-lisp/cl-preloaded.el')
-rw-r--r--lisp/emacs-lisp/cl-preloaded.el8
1 files changed, 5 insertions, 3 deletions
diff --git a/lisp/emacs-lisp/cl-preloaded.el b/lisp/emacs-lisp/cl-preloaded.el
index 639ffa64b8c..2b022c49053 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