From: Gerd Moellmann Date: Wed, 12 Jan 2000 13:14:48 +0000 (+0000) Subject: (eval-last-sexp-1): Renamed from X-Git-Tag: emacs-pretest-21.0.90~5370 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=99c6d63bb2f002da2a450dc6c1014c3e5fdc8577;p=emacs.git (eval-last-sexp-1): Renamed from eval-last-sexp. Don't bind debug-on-error here. (eval-last-sexp): New function. Bind debug-on-error if eval-expression-debug-on-error is non-nil. (eval-defun-2, eval-defun): Likewise. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index e9c8de220f0..d9fc7693054 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,17 @@ +2000-01-12 Gerd Moellmann + + * emacs-lisp/lisp-mode.el (eval-last-sexp-1): Renamed from + eval-last-sexp. Don't bind debug-on-error here. + (eval-last-sexp): New function. Bind debug-on-error if + eval-expression-debug-on-error is non-nil. + (eval-defun-2, eval-defun): Likewise. + + * simple.el (eval-expression): Don't bind debug-on-error if + eval-expression-debug-on-error is nil. Detect changed + debug-on-error, and propagate new value to global binding, if + eval-expression-debug-on-error is non-nil, + (eval-expression-debug-on-error): Change doc string. + 2000-01-11 Richard M. Stallman * emacs-lisp/edebug.el (with-syntax-table): Add a def-edebug-spec. diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el index 6135d100fbf..6d4bfc871ca 100644 --- a/lisp/emacs-lisp/lisp-mode.el +++ b/lisp/emacs-lisp/lisp-mode.el @@ -332,12 +332,10 @@ if that value is non-nil." (eval-last-sexp t) (terpri))) -(defun eval-last-sexp (eval-last-sexp-arg-internal) +(defun eval-last-sexp-1 (eval-last-sexp-arg-internal) "Evaluate sexp before point; print value in minibuffer. With argument, print output into current buffer." - (interactive "P") - (let ((standard-output (if eval-last-sexp-arg-internal (current-buffer) t)) - (debug-on-error eval-expression-debug-on-error)) + (let ((standard-output (if eval-last-sexp-arg-internal (current-buffer) t))) (let ((value (eval (let ((stab (syntax-table)) (opoint (point)) @@ -385,6 +383,20 @@ With argument, print output into current buffer." (print-level eval-expression-print-level)) (prin1 value))))) +(defun eval-last-sexp (eval-last-sexp-arg-internal) + "Evaluate sexp before point; print value in minibuffer. +With argument, print output into current buffer." + (interactive "P") + (if (null eval-expression-debug-on-error) + (eval-last-sexp-1 eval-last-sexp-arg-internal) + (let ((old-value (make-symbol "t")) 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))) + ;; Change defvar into defconst within FORM, ;; and likewise for other constructs as necessary. (defun eval-defun-1 (form) @@ -401,7 +413,7 @@ With argument, print output into current buffer." (cons 'progn (mapcar 'eval-defun-1 (cdr form)))) (t form))) -(defun eval-defun (eval-defun-arg-internal) +(defun eval-defun-2 (eval-defun-arg-internal) "Evaluate defun that point is in or before. The value is displayed in the minibuffer. If the current defun is actually a call to `defvar', @@ -442,6 +454,29 @@ Return the result of evaluation." ',form)))))) ;; The result of evaluation has been put onto VALUES. So return it. (car values)) + +(defun eval-defun (eval-defun-arg-internal) + "Evaluate defun that point is in or before. +The value is displayed in the minibuffer. +If the current defun is actually a call to `defvar', +then reset the variable using the initial value expression +even if the variable already has some other value. +\(Normally `defvar' does not change the variable's value +if it already has a value.\) + +With argument, insert value in current buffer after the defun. +Return the result of evaluation." + (interactive "P") + (if (null eval-expression-debug-on-error) + (eval-defun-2 eval-defun-arg-internal) + (let ((old-value (make-symbol "t")) new-value value) + (let ((debug-on-error old-value)) + (setq value (eval-defun-2 eval-defun-arg-internal)) + (setq new-value debug-on-error)) + (unless (eq old-value new-value) + (setq debug-on-error new-value)) + value))) + (defun lisp-comment-indent () (if (looking-at "\\s<\\s<\\s<")