Mercurial > emacs
comparison lisp/emacs-lisp/lisp-mode.el @ 30055:16e560dd4ab8
(eval-defun-2): Remove parameter
EVAL-DEFUN-ARG-INTERNAL; always print to minibuffer.
(eval-defun): If called with prefix arg, instrument code for
Edebug.
author | Gerd Moellmann <gerd@gnu.org> |
---|---|
date | Wed, 05 Jul 2000 15:16:15 +0000 |
parents | 0388cb689633 |
children | d470d496fd53 |
comparison
equal
deleted
inserted
replaced
30054:72640301c1fe | 30055:16e560dd4ab8 |
---|---|
406 form) | 406 form) |
407 ((eq (car form) 'progn) | 407 ((eq (car form) 'progn) |
408 (cons 'progn (mapcar 'eval-defun-1 (cdr form)))) | 408 (cons 'progn (mapcar 'eval-defun-1 (cdr form)))) |
409 (t form))) | 409 (t form))) |
410 | 410 |
411 (defun eval-defun-2 (eval-defun-arg-internal) | 411 (defun eval-defun-2 () |
412 "Evaluate defun that point is in or before. | 412 "Evaluate defun that point is in or before. |
413 The value is displayed in the minibuffer. | 413 The value is displayed in the minibuffer. |
414 If the current defun is actually a call to `defvar', | 414 If the current defun is actually a call to `defvar', |
415 then reset the variable using the initial value expression | 415 then reset the variable using the initial value expression |
416 even if the variable already has some other value. | 416 even if the variable already has some other value. |
428 ;; eval-region handles recording which file defines a function or | 428 ;; eval-region handles recording which file defines a function or |
429 ;; variable. Re-written using `apply' to avoid capturing | 429 ;; variable. Re-written using `apply' to avoid capturing |
430 ;; variables like `end'. | 430 ;; variables like `end'. |
431 (apply | 431 (apply |
432 #'eval-region | 432 #'eval-region |
433 (let ((standard-output (if eval-defun-arg-internal (current-buffer) t)) | 433 (let ((standard-output t) |
434 beg end form) | 434 beg end form) |
435 ;; Read the form from the buffer, and record where it ends. | 435 ;; Read the form from the buffer, and record where it ends. |
436 (save-excursion | 436 (save-excursion |
437 (end-of-defun) | 437 (end-of-defun) |
438 (beginning-of-defun) | 438 (beginning-of-defun) |
448 (goto-char ,end) | 448 (goto-char ,end) |
449 ',form)))))) | 449 ',form)))))) |
450 ;; The result of evaluation has been put onto VALUES. So return it. | 450 ;; The result of evaluation has been put onto VALUES. So return it. |
451 (car values)) | 451 (car values)) |
452 | 452 |
453 (defun eval-defun (eval-defun-arg-internal) | 453 (defun eval-defun (edebug-it) |
454 "Evaluate defun that point is in or before. | 454 "Evaluate the top-level form containing point, or after point. |
455 The value is displayed in the minibuffer. | 455 |
456 If the current defun is actually a call to `defvar', | 456 If the current defun is actually a call to `defvar', then reset the |
457 then reset the variable using the initial value expression | 457 variable using its initial value expression even if the variable |
458 even if the variable already has some other value. | 458 already has some other value. (Normally `defvar' does not change the |
459 \(Normally `defvar' does not change the variable's value | 459 variable's value if it already has a value.) |
460 if it already has a value.\) | 460 |
461 | 461 With a prefix argument, instrument the code for Edebug. |
462 With argument, insert value in current buffer after the defun. | 462 |
463 Return the result of evaluation." | 463 If acting on a `defun' for FUNCTION, and the function was |
464 instrumented, `Edebug: FUNCTION' is printed in the minibuffer. If not | |
465 instrumented, just FUNCTION is printed. | |
466 | |
467 If not acting on a `defun', the result of evaluation is displayed in | |
468 the minibuffer." | |
464 (interactive "P") | 469 (interactive "P") |
465 (if (null eval-expression-debug-on-error) | 470 (cond (edebug-it |
466 (eval-defun-2 eval-defun-arg-internal) | 471 (require 'edebug) |
467 (let ((old-value (make-symbol "t")) new-value value) | 472 (eval-defun (not edebug-all-defs))) |
468 (let ((debug-on-error old-value)) | 473 (t |
469 (setq value (eval-defun-2 eval-defun-arg-internal)) | 474 (if (null eval-expression-debug-on-error) |
470 (setq new-value debug-on-error)) | 475 (eval-defun-2) |
471 (unless (eq old-value new-value) | 476 (let ((old-value (make-symbol "t")) new-value value) |
472 (setq debug-on-error new-value)) | 477 (let ((debug-on-error old-value)) |
473 value))) | 478 (setq value (eval-defun-2)) |
479 (setq new-value debug-on-error)) | |
480 (unless (eq old-value new-value) | |
481 (setq debug-on-error new-value)) | |
482 value))))) | |
474 | 483 |
475 | 484 |
476 (defun lisp-comment-indent () | 485 (defun lisp-comment-indent () |
477 (if (looking-at "\\s<\\s<\\s<") | 486 (if (looking-at "\\s<\\s<\\s<") |
478 (current-column) | 487 (current-column) |