diff options
| author | Gerd Moellmann | 2000-01-12 13:14:48 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 2000-01-12 13:14:48 +0000 |
| commit | 99c6d63bb2f002da2a450dc6c1014c3e5fdc8577 (patch) | |
| tree | 40a163177d9c8899d94d21371ffa48dfc9e5c306 | |
| parent | ed8bcabea8346bcabb6b6891582721b8544a83df (diff) | |
| download | emacs-99c6d63bb2f002da2a450dc6c1014c3e5fdc8577.tar.gz emacs-99c6d63bb2f002da2a450dc6c1014c3e5fdc8577.zip | |
(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.
| -rw-r--r-- | lisp/ChangeLog | 14 | ||||
| -rw-r--r-- | lisp/emacs-lisp/lisp-mode.el | 45 |
2 files changed, 54 insertions, 5 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index e9c8de220f0..d9fc7693054 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,17 @@ | |||
| 1 | 2000-01-12 Gerd Moellmann <gerd@gnu.org> | ||
| 2 | |||
| 3 | * emacs-lisp/lisp-mode.el (eval-last-sexp-1): Renamed from | ||
| 4 | eval-last-sexp. Don't bind debug-on-error here. | ||
| 5 | (eval-last-sexp): New function. Bind debug-on-error if | ||
| 6 | eval-expression-debug-on-error is non-nil. | ||
| 7 | (eval-defun-2, eval-defun): Likewise. | ||
| 8 | |||
| 9 | * simple.el (eval-expression): Don't bind debug-on-error if | ||
| 10 | eval-expression-debug-on-error is nil. Detect changed | ||
| 11 | debug-on-error, and propagate new value to global binding, if | ||
| 12 | eval-expression-debug-on-error is non-nil, | ||
| 13 | (eval-expression-debug-on-error): Change doc string. | ||
| 14 | |||
| 1 | 2000-01-11 Richard M. Stallman <rms@caffeine.ai.mit.edu> | 15 | 2000-01-11 Richard M. Stallman <rms@caffeine.ai.mit.edu> |
| 2 | 16 | ||
| 3 | * emacs-lisp/edebug.el (with-syntax-table): Add a def-edebug-spec. | 17 | * 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." | |||
| 332 | (eval-last-sexp t) | 332 | (eval-last-sexp t) |
| 333 | (terpri))) | 333 | (terpri))) |
| 334 | 334 | ||
| 335 | (defun eval-last-sexp (eval-last-sexp-arg-internal) | 335 | (defun eval-last-sexp-1 (eval-last-sexp-arg-internal) |
| 336 | "Evaluate sexp before point; print value in minibuffer. | 336 | "Evaluate sexp before point; print value in minibuffer. |
| 337 | With argument, print output into current buffer." | 337 | With argument, print output into current buffer." |
| 338 | (interactive "P") | 338 | (let ((standard-output (if eval-last-sexp-arg-internal (current-buffer) t))) |
| 339 | (let ((standard-output (if eval-last-sexp-arg-internal (current-buffer) t)) | ||
| 340 | (debug-on-error eval-expression-debug-on-error)) | ||
| 341 | (let ((value | 339 | (let ((value |
| 342 | (eval (let ((stab (syntax-table)) | 340 | (eval (let ((stab (syntax-table)) |
| 343 | (opoint (point)) | 341 | (opoint (point)) |
| @@ -385,6 +383,20 @@ With argument, print output into current buffer." | |||
| 385 | (print-level eval-expression-print-level)) | 383 | (print-level eval-expression-print-level)) |
| 386 | (prin1 value))))) | 384 | (prin1 value))))) |
| 387 | 385 | ||
| 386 | (defun eval-last-sexp (eval-last-sexp-arg-internal) | ||
| 387 | "Evaluate sexp before point; print value in minibuffer. | ||
| 388 | With argument, print output into current buffer." | ||
| 389 | (interactive "P") | ||
| 390 | (if (null eval-expression-debug-on-error) | ||
| 391 | (eval-last-sexp-1 eval-last-sexp-arg-internal) | ||
| 392 | (let ((old-value (make-symbol "t")) new-value value) | ||
| 393 | (let ((debug-on-error old-value)) | ||
| 394 | (setq value (eval-last-sexp-1 eval-last-sexp-arg-internal)) | ||
| 395 | (setq new-value debug-on-error)) | ||
| 396 | (unless (eq old-value new-value) | ||
| 397 | (setq debug-on-error new-value)) | ||
| 398 | value))) | ||
| 399 | |||
| 388 | ;; Change defvar into defconst within FORM, | 400 | ;; Change defvar into defconst within FORM, |
| 389 | ;; and likewise for other constructs as necessary. | 401 | ;; and likewise for other constructs as necessary. |
| 390 | (defun eval-defun-1 (form) | 402 | (defun eval-defun-1 (form) |
| @@ -401,7 +413,7 @@ With argument, print output into current buffer." | |||
| 401 | (cons 'progn (mapcar 'eval-defun-1 (cdr form)))) | 413 | (cons 'progn (mapcar 'eval-defun-1 (cdr form)))) |
| 402 | (t form))) | 414 | (t form))) |
| 403 | 415 | ||
| 404 | (defun eval-defun (eval-defun-arg-internal) | 416 | (defun eval-defun-2 (eval-defun-arg-internal) |
| 405 | "Evaluate defun that point is in or before. | 417 | "Evaluate defun that point is in or before. |
| 406 | The value is displayed in the minibuffer. | 418 | The value is displayed in the minibuffer. |
| 407 | If the current defun is actually a call to `defvar', | 419 | If the current defun is actually a call to `defvar', |
| @@ -442,6 +454,29 @@ Return the result of evaluation." | |||
| 442 | ',form)))))) | 454 | ',form)))))) |
| 443 | ;; The result of evaluation has been put onto VALUES. So return it. | 455 | ;; The result of evaluation has been put onto VALUES. So return it. |
| 444 | (car values)) | 456 | (car values)) |
| 457 | |||
| 458 | (defun eval-defun (eval-defun-arg-internal) | ||
| 459 | "Evaluate defun that point is in or before. | ||
| 460 | The value is displayed in the minibuffer. | ||
| 461 | If the current defun is actually a call to `defvar', | ||
| 462 | then reset the variable using the initial value expression | ||
| 463 | even if the variable already has some other value. | ||
| 464 | \(Normally `defvar' does not change the variable's value | ||
| 465 | if it already has a value.\) | ||
| 466 | |||
| 467 | With argument, insert value in current buffer after the defun. | ||
| 468 | Return the result of evaluation." | ||
| 469 | (interactive "P") | ||
| 470 | (if (null eval-expression-debug-on-error) | ||
| 471 | (eval-defun-2 eval-defun-arg-internal) | ||
| 472 | (let ((old-value (make-symbol "t")) new-value value) | ||
| 473 | (let ((debug-on-error old-value)) | ||
| 474 | (setq value (eval-defun-2 eval-defun-arg-internal)) | ||
| 475 | (setq new-value debug-on-error)) | ||
| 476 | (unless (eq old-value new-value) | ||
| 477 | (setq debug-on-error new-value)) | ||
| 478 | value))) | ||
| 479 | |||
| 445 | 480 | ||
| 446 | (defun lisp-comment-indent () | 481 | (defun lisp-comment-indent () |
| 447 | (if (looking-at "\\s<\\s<\\s<") | 482 | (if (looking-at "\\s<\\s<\\s<") |