diff options
| author | Richard M. Stallman | 1999-09-14 07:00:36 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1999-09-14 07:00:36 +0000 |
| commit | efb195f0cac5bbf89022e43b8008a33aa9c025f4 (patch) | |
| tree | 80cfb8c7a94b7d4649a02609fa053027b9cc0a74 | |
| parent | b49df39ddcfc578234530208eba8e288f604db1b (diff) | |
| download | emacs-efb195f0cac5bbf89022e43b8008a33aa9c025f4.tar.gz emacs-efb195f0cac5bbf89022e43b8008a33aa9c025f4.zip | |
(eval-defun, eval-last-sexp):
Bind print-level, print-length and debug-on-error.
| -rw-r--r-- | lisp/emacs-lisp/lisp-mode.el | 62 |
1 files changed, 35 insertions, 27 deletions
diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el index 00464730359..b4b9f0b92a4 100644 --- a/lisp/emacs-lisp/lisp-mode.el +++ b/lisp/emacs-lisp/lisp-mode.el | |||
| @@ -326,8 +326,10 @@ if that value is non-nil." | |||
| 326 | "Evaluate sexp before point; print value in minibuffer. | 326 | "Evaluate sexp before point; print value in minibuffer. |
| 327 | With argument, print output into current buffer." | 327 | With argument, print output into current buffer." |
| 328 | (interactive "P") | 328 | (interactive "P") |
| 329 | (let ((standard-output (if eval-last-sexp-arg-internal (current-buffer) t))) | 329 | (let ((standard-output (if eval-last-sexp-arg-internal (current-buffer) t)) |
| 330 | (prin1 (eval (let ((stab (syntax-table)) | 330 | (debug-on-error eval-expression-debug-on-error)) |
| 331 | (let ((value | ||
| 332 | (eval (let ((stab (syntax-table)) | ||
| 331 | (opoint (point)) | 333 | (opoint (point)) |
| 332 | ignore-quotes | 334 | ignore-quotes |
| 333 | expr) | 335 | expr) |
| @@ -368,7 +370,10 @@ With argument, print output into current buffer." | |||
| 368 | expr | 370 | expr |
| 369 | 'args))))) | 371 | 'args))))) |
| 370 | expr)) | 372 | expr)) |
| 371 | (set-syntax-table stab))))))) | 373 | (set-syntax-table stab)))))) |
| 374 | (let ((print-length eval-expression-print-length) | ||
| 375 | (print-level eval-expression-print-level)) | ||
| 376 | (print value))))) | ||
| 372 | 377 | ||
| 373 | ;; Change defvar into defconst within FORM, | 378 | ;; Change defvar into defconst within FORM, |
| 374 | ;; and likewise for other constructs as necessary. | 379 | ;; and likewise for other constructs as necessary. |
| @@ -398,30 +403,33 @@ if it already has a value.\) | |||
| 398 | With argument, insert value in current buffer after the defun. | 403 | With argument, insert value in current buffer after the defun. |
| 399 | Return the result of evaluation." | 404 | Return the result of evaluation." |
| 400 | (interactive "P") | 405 | (interactive "P") |
| 401 | (save-excursion | 406 | (let ((debug-on-error eval-expression-debug-on-error) |
| 402 | ;; Arrange for eval-region to "read" the (possibly) altered form. | 407 | (print-length eval-expression-print-length) |
| 403 | ;; eval-region handles recording which file defines a function or | 408 | (print-level eval-expression-print-level)) |
| 404 | ;; variable. Re-written using `apply' to avoid capturing | 409 | (save-excursion |
| 405 | ;; variables like `end'. | 410 | ;; Arrange for eval-region to "read" the (possibly) altered form. |
| 406 | (apply | 411 | ;; eval-region handles recording which file defines a function or |
| 407 | #'eval-region | 412 | ;; variable. Re-written using `apply' to avoid capturing |
| 408 | (let ((standard-output (if eval-defun-arg-internal (current-buffer) t)) | 413 | ;; variables like `end'. |
| 409 | beg end form) | 414 | (apply |
| 410 | ;; Read the form from the buffer, and record where it ends. | 415 | #'eval-region |
| 411 | (save-excursion | 416 | (let ((standard-output (if eval-defun-arg-internal (current-buffer) t)) |
| 412 | (end-of-defun) | 417 | beg end form) |
| 413 | (beginning-of-defun) | 418 | ;; Read the form from the buffer, and record where it ends. |
| 414 | (setq beg (point)) | 419 | (save-excursion |
| 415 | (setq form (read (current-buffer))) | 420 | (end-of-defun) |
| 416 | (setq end (point))) | 421 | (beginning-of-defun) |
| 417 | ;; Alter the form if necessary, changing defvar into defconst, etc. | 422 | (setq beg (point)) |
| 418 | (setq form (eval-defun-1 (macroexpand form))) | 423 | (setq form (read (current-buffer))) |
| 419 | (list beg end standard-output | 424 | (setq end (point))) |
| 420 | `(lambda (ignore) | 425 | ;; Alter the form if necessary, changing defvar into defconst, etc. |
| 421 | ;; Skipping to the end of the specified region | 426 | (setq form (eval-defun-1 (macroexpand form))) |
| 422 | ;; will make eval-region return. | 427 | (list beg end standard-output |
| 423 | (goto-char ,end) | 428 | `(lambda (ignore) |
| 424 | ',form))))) | 429 | ;; Skipping to the end of the specified region |
| 430 | ;; will make eval-region return. | ||
| 431 | (goto-char ,end) | ||
| 432 | ',form)))))) | ||
| 425 | ;; The result of evaluation has been put onto VALUES. So return it. | 433 | ;; The result of evaluation has been put onto VALUES. So return it. |
| 426 | (car values)) | 434 | (car values)) |
| 427 | 435 | ||