[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master bcdcaf0219 2/2: Make the eval-in-debug error message prettier in
From: |
Lars Ingebrigtsen |
Subject: |
master bcdcaf0219 2/2: Make the eval-in-debug error message prettier in non-recursive errors |
Date: |
Mon, 2 May 2022 07:59:32 -0400 (EDT) |
branch: master
commit bcdcaf0219906862d02f1e6ab83972c8f4d3c0ba
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>
Make the eval-in-debug error message prettier in non-recursive errors
* lisp/emacs-lisp/debug.el (debugger-eval-expression): Make the
error message (when recursive debugging is off) prettier.
---
lisp/emacs-lisp/debug.el | 28 +++++++++++++++++-----------
1 file changed, 17 insertions(+), 11 deletions(-)
diff --git a/lisp/emacs-lisp/debug.el b/lisp/emacs-lisp/debug.el
index 91e9b0716d..6c172d6c31 100644
--- a/lisp/emacs-lisp/debug.el
+++ b/lisp/emacs-lisp/debug.el
@@ -539,17 +539,23 @@ The environment used is the one when entering the
activation frame at point."
(error 0)))) ;; If on first line.
(base (debugger--backtrace-base)))
(debugger-env-macro
- (let ((val (if debug-allow-recursive-debug
- (backtrace-eval exp nframe base)
- (condition-case err
- (backtrace-eval exp nframe base)
- (error (format "%s: %s"
- (get (car err) 'error-message)
- (car (cdr err))))))))
- (prog1
- (debugger--print val t)
- (let ((str (eval-expression-print-format val)))
- (if str (princ str t))))))))
+ (let* ((errored nil)
+ (val (if debug-allow-recursive-debug
+ (backtrace-eval exp nframe base)
+ (condition-case err
+ (backtrace-eval exp nframe base)
+ (error (setq errored
+ (format "%s: %s"
+ (get (car err) 'error-message)
+ (car (cdr err)))))))))
+ (if errored
+ (progn
+ (message "Error: %s" errored)
+ nil)
+ (prog1
+ (debugger--print val t)
+ (let ((str (eval-expression-print-format val)))
+ (if str (princ str t)))))))))
(define-obsolete-function-alias 'debugger-toggle-locals
'backtrace-toggle-locals "28.1")