GNU bug report logs -
#67196
M-: uses a wrong value of debug-on-error when it is nil.
Previous Next
Reported by: Alan Mackenzie <acm <at> muc.de>
Date: Wed, 15 Nov 2023 17:03:02 UTC
Severity: normal
Done: Alan Mackenzie <acm <at> muc.de>
Bug is archived. No further changes may be made.
Full log
Message #83 received at 67196 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
> Side note: there's recently been several things pointing to the need to
> add something like Common Lisp's `handler-bind`.
BTW, I now have working code implementing `handler-bind` (see bug#67862
for a preview of the code). With it I can fix this bug with the
patch below (well, plus a tweak in `debug.el` plus some docstring
adjustements).
Stefan
[eval-expression.patch (text/x-diff, inline)]
diff --git a/lisp/simple.el b/lisp/simple.el
index cee1ddac52f..da07a249081 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -2120,23 +2120,17 @@ eval-expression
(cons (read--expression "Eval: ")
(eval-expression-get-print-arguments current-prefix-arg)))
- (let (result)
+ (let* (result
+ (runfun
+ (lambda ()
+ (setq result
+ (values--store-value
+ (eval (let ((lexical-binding t)) (macroexpand-all exp))
+ t))))))
(if (null eval-expression-debug-on-error)
- (setq result
- (values--store-value
- (eval (let ((lexical-binding t)) (macroexpand-all exp)) t)))
- (let ((old-value (make-symbol "t")) new-value)
- ;; Bind debug-on-error to something unique so that we can
- ;; detect when evalled code changes it.
- (let ((debug-on-error old-value))
- (setq result
- (values--store-value
- (eval (let ((lexical-binding t)) (macroexpand-all exp)) t)))
- (setq new-value debug-on-error))
- ;; If evalled code has changed the value of debug-on-error,
- ;; propagate that change to the global binding.
- (unless (eq old-value new-value)
- (setq debug-on-error new-value))))
+ (funcall runfun)
+ (handler-bind ((error debugger))
+ (funcall runfun)))
(let ((print-length (unless no-truncate eval-expression-print-length))
(print-level (unless no-truncate eval-expression-print-level))
This bug report was last modified 211 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.