From 01d4effe81aa809fdab0c483371bf15356cc4c43 Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Fri, 6 Jul 2007 17:30:06 +0000 Subject: [PATCH] (eval-last-sexp): Avoid introducing any dynamic bindings around the evaluation of the expression. --- lisp/ChangeLog | 6 ++++++ lisp/emacs-lisp/lisp-mode.el | 14 +++++++------- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index c6e7ef04cee..adfef8ab290 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2007-07-06 Andreas Schwab + + * emacs-lisp/lisp-mode.el (eval-last-sexp): Avoid introducing any + dynamic bindings around the evaluation of the expression. + Reported by Jay Belanger . + 2007-07-03 Dan Nicolaescu * progmodes/gud.el (auto-mode-alist): Match more valid gdb init diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el index 164756dfdc3..73379a816d7 100644 --- a/lisp/emacs-lisp/lisp-mode.el +++ b/lisp/emacs-lisp/lisp-mode.el @@ -628,13 +628,13 @@ this command arranges for all errors to enter the debugger." (interactive "P") (if (null eval-expression-debug-on-error) (eval-last-sexp-1 eval-last-sexp-arg-internal) - (let ((old-value eval-last-sexp-fake-value) new-value value) - (let ((debug-on-error old-value)) - (setq value (eval-last-sexp-1 eval-last-sexp-arg-internal)) - (setq new-value debug-on-error)) - (unless (eq old-value new-value) - (setq debug-on-error new-value)) - value))) + (let ((value + (let ((debug-on-error eval-last-sexp-fake-value)) + (cons (eval-last-sexp-1 eval-last-sexp-arg-internal) + debug-on-error)))) + (unless (eq (cdr value) eval-last-sexp-fake-value) + (setq debug-on-error (cdr value))) + (car value)))) (defun eval-defun-1 (form) "Treat some expressions specially. -- 2.39.2