diff options
| author | Luc Teirlinck | 2003-12-25 03:42:52 +0000 |
|---|---|---|
| committer | Luc Teirlinck | 2003-12-25 03:42:52 +0000 |
| commit | 636a7460c98ebbe224b2df8425fd6793a884b15a (patch) | |
| tree | dc2cc87f16cc65da29b55bf6ead08ccef38e95cd | |
| parent | 136b1dff192e1b0345c5ac92b9ed2231af2e65e1 (diff) | |
| download | emacs-636a7460c98ebbe224b2df8425fd6793a884b15a.tar.gz emacs-636a7460c98ebbe224b2df8425fd6793a884b15a.zip | |
(Function Indirection): Describe the errors that `indirect-function'
can signal.
(Eval): Clarify the descriptions of `eval-region' and `values'.
Describe `eval-buffer' instead of `eval-current-buffer' and mention
`eval-current-buffer' as an alias for `current-buffer'. Correct the
description and mention all optional arguments.
| -rw-r--r-- | lispref/eval.texi | 58 |
1 files changed, 42 insertions, 16 deletions
diff --git a/lispref/eval.texi b/lispref/eval.texi index 165889e75ed..fcfde5849dd 100644 --- a/lispref/eval.texi +++ b/lispref/eval.texi | |||
| @@ -319,6 +319,10 @@ This function returns the meaning of @var{function} as a function. If | |||
| 319 | definition and starts over with that value. If @var{function} is not a | 319 | definition and starts over with that value. If @var{function} is not a |
| 320 | symbol, then it returns @var{function} itself. | 320 | symbol, then it returns @var{function} itself. |
| 321 | 321 | ||
| 322 | This function signals a @code{void-function} error if the final | ||
| 323 | symbol is unbound and a @code{cyclic-function-indirection} error if | ||
| 324 | there is a loop in the chain of symbols. | ||
| 325 | |||
| 322 | Here is how you could define @code{indirect-function} in Lisp: | 326 | Here is how you could define @code{indirect-function} in Lisp: |
| 323 | 327 | ||
| 324 | @smallexample | 328 | @smallexample |
| @@ -625,32 +629,51 @@ The number of currently active calls to @code{eval} is limited to | |||
| 625 | @code{max-lisp-eval-depth} (see below). | 629 | @code{max-lisp-eval-depth} (see below). |
| 626 | @end defun | 630 | @end defun |
| 627 | 631 | ||
| 632 | @anchor{Definition of eval-region} | ||
| 628 | @deffn Command eval-region start end &optional stream read-function | 633 | @deffn Command eval-region start end &optional stream read-function |
| 629 | This function evaluates the forms in the current buffer in the region | 634 | This function evaluates the forms in the current buffer in the region |
| 630 | defined by the positions @var{start} and @var{end}. It reads forms from | 635 | defined by the positions @var{start} and @var{end}. It reads forms from |
| 631 | the region and calls @code{eval} on them until the end of the region is | 636 | the region and calls @code{eval} on them until the end of the region is |
| 632 | reached, or until an error is signaled and not handled. | 637 | reached, or until an error is signaled and not handled. |
| 633 | 638 | ||
| 634 | If @var{stream} is non-@code{nil}, the values that result from | 639 | By default, @code{eval-region} does not produce any output. However, |
| 635 | evaluating the expressions in the region are printed using @var{stream}. | 640 | if @var{stream} is non-@code{nil}, any output produced by output |
| 636 | @xref{Output Streams}. | 641 | functions (@pxref{Output Functions}), as well as the values that |
| 637 | 642 | result from evaluating the expressions in the region are printed using | |
| 638 | If @var{read-function} is non-@code{nil}, it should be a function, which | 643 | @var{stream}. @xref{Output Streams}. |
| 639 | is used instead of @code{read} to read expressions one by one. This | 644 | |
| 640 | function is called with one argument, the stream for reading input. You | 645 | If @var{read-function} is non-@code{nil}, it should be a function, |
| 641 | can also use the variable @code{load-read-function} (@pxref{How Programs | 646 | which is used instead of @code{read} to read expressions one by one. |
| 642 | Do Loading}) to specify this function, but it is more robust to use the | 647 | This function is called with one argument, the stream for reading |
| 648 | input. You can also use the variable @code{load-read-function} | ||
| 649 | (@pxref{Definition of load-read-function,, How Programs Do Loading}) | ||
| 650 | to specify this function, but it is more robust to use the | ||
| 643 | @var{read-function} argument. | 651 | @var{read-function} argument. |
| 644 | 652 | ||
| 645 | @code{eval-region} always returns @code{nil}. | 653 | @code{eval-region} does not move point. It always returns @code{nil}. |
| 646 | @end deffn | 654 | @end deffn |
| 647 | 655 | ||
| 648 | @cindex evaluation of buffer contents | 656 | @cindex evaluation of buffer contents |
| 649 | @deffn Command eval-current-buffer &optional stream | 657 | @deffn Command eval-buffer &optional buffer-or-name stream filename unibyte print |
| 650 | This is like @code{eval-region} except that it operates on the whole | 658 | This is similar to @code{eval-region}, but the arguments provide |
| 651 | buffer. | 659 | different optional features. @code{eval-buffer} operates on the |
| 660 | entire accessible portion of buffer @var{buffer-or-name}. | ||
| 661 | @var{buffer-or-name} can be a buffer, a buffer name (a string), or | ||
| 662 | @code{nil} (or omitted), which means to use the current buffer. | ||
| 663 | @var{stream} is used as in @code{eval-region}, unless @var{stream} is | ||
| 664 | @code{nil} and @var{print} non-@code{nil}. In that case, values that | ||
| 665 | result from evaluating the expressions are still discarded, but the | ||
| 666 | output of the output functions is printed in the echo area. | ||
| 667 | @var{filename} is the file name to use for @code{load-history} | ||
| 668 | (@pxref{Unloading}), and defaults to @code{buffer-file-name} | ||
| 669 | (@pxref{Buffer File Name}). If @var{unibyte} is non-@code{nil}, | ||
| 670 | @code{read} converts strings to unibyte whenever possible. | ||
| 671 | |||
| 672 | @findex eval-current-buffer | ||
| 673 | @code{eval-current-buffer} is an alias for this command. | ||
| 652 | @end deffn | 674 | @end deffn |
| 653 | 675 | ||
| 676 | @anchor{Definition of max-lisp-eval-depth} | ||
| 654 | @defvar max-lisp-eval-depth | 677 | @defvar max-lisp-eval-depth |
| 655 | This variable defines the maximum depth allowed in calls to @code{eval}, | 678 | This variable defines the maximum depth allowed in calls to @code{eval}, |
| 656 | @code{apply}, and @code{funcall} before an error is signaled (with error | 679 | @code{apply}, and @code{funcall} before an error is signaled (with error |
| @@ -670,14 +693,17 @@ Entry to the Lisp debugger increases the value, if there is little room | |||
| 670 | left, to make sure the debugger itself has room to execute. | 693 | left, to make sure the debugger itself has room to execute. |
| 671 | 694 | ||
| 672 | @code{max-specpdl-size} provides another limit on nesting. | 695 | @code{max-specpdl-size} provides another limit on nesting. |
| 673 | @xref{Local Variables}. | 696 | @xref{Definition of max-specpdl-size,, Local Variables}. |
| 674 | @end defvar | 697 | @end defvar |
| 675 | 698 | ||
| 676 | @defvar values | 699 | @defvar values |
| 677 | The value of this variable is a list of the values returned by all the | 700 | The value of this variable is a list of the values returned by all the |
| 678 | expressions that were read, evaluated, and printed from buffers | 701 | expressions that were read, evaluated, and printed from buffers |
| 679 | (including the minibuffer) by the standard Emacs commands which do this. | 702 | (including the minibuffer) by the standard Emacs commands which do |
| 680 | The elements are ordered most recent first. | 703 | this. (Note that this does @emph{not} include evaluation in |
| 704 | @samp{*ielm*} buffers, nor evaluation using @kbd{C-j} in | ||
| 705 | @code{lisp-interaction-mode}.) The elements are ordered most recent | ||
| 706 | first. | ||
| 681 | 707 | ||
| 682 | @example | 708 | @example |
| 683 | @group | 709 | @group |