Mercurial > hg > xemacs-beta
comparison man/lispref/variables.texi @ 5361:62b9ef1ed4ac
Change "special form" to "special operator" in the manuals, too
2011-03-01 Aidan Kehoe <kehoea@parhasard.net>
* lispref/commands.texi (Using Interactive):
* lispref/compile.texi (Eval During Compile):
* lispref/compile.texi (Compiled-Function Objects):
* lispref/control.texi (Sequencing):
* lispref/control.texi (Conditionals):
* lispref/control.texi (Combining Conditions):
* lispref/control.texi (Iteration):
* lispref/control.texi (Catch and Throw):
* lispref/control.texi (Handling Errors):
* lispref/control.texi (Cleanups):
* lispref/display.texi (Temporary Displays):
* lispref/eval.texi (Quoting):
* lispref/eval.texi (Multiple values):
* lispref/frames.texi (Input Focus):
* lispref/functions.texi (Argument List):
* lispref/functions.texi (Defining Functions):
* lispref/functions.texi (Anonymous Functions):
* lispref/internationalization.texi (Level 3 Primitives):
* lispref/internationalization.texi (Domain Specification):
* lispref/intro.texi (A Sample Function Description):
* lispref/intro.texi (A Sample Variable Description):
* lispref/lists.texi (Sets And Lists):
* lispref/macros.texi (Defining Macros):
* lispref/macros.texi (Backquote):
* lispref/positions.texi (Excursions):
* lispref/positions.texi (Narrowing):
* lispref/searching.texi (Saving Match Data):
* lispref/sequences.texi (Sequence Functions):
* lispref/sequences.texi (Array Functions):
* lispref/specifiers.texi (Adding Specifications):
* lispref/variables.texi (Local Variables):
* lispref/variables.texi (Defining Variables):
* lispref/variables.texi (Setting Variables):
* lispref/variables.texi (Default Value):
* lispref/windows.texi (Selecting Windows):
* lispref/windows.texi (Window Configurations):
No longer use @defspec, since we no longer use the term "special
form"; instead use @deffn {Special Operator}. Unfortunately
there's no way in texinfo to redefine @defspec in one place.
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Tue, 01 Mar 2011 14:18:45 +0000 |
parents | 755ae5b97edb |
children | 9fae6227ede5 |
comparison
equal
deleted
inserted
replaced
5359:f5a5501814f5 | 5361:62b9ef1ed4ac |
---|---|
166 binding. | 166 binding. |
167 | 167 |
168 The special operators @code{let} and @code{let*} exist to create | 168 The special operators @code{let} and @code{let*} exist to create |
169 local bindings. | 169 local bindings. |
170 | 170 |
171 @defspec let (bindings@dots{}) forms@dots{} | 171 @deffn {Special Operator} let (bindings@dots{}) forms@dots{} |
172 This special operator binds variables according to @var{bindings} and then | 172 This special operator binds variables according to @var{bindings} and then |
173 evaluates all of the @var{forms} in textual order. The @code{let}-form | 173 evaluates all of the @var{forms} in textual order. The @code{let}-form |
174 returns the value of the last form in @var{forms}. | 174 returns the value of the last form in @var{forms}. |
175 | 175 |
176 Each of the @var{bindings} is either @w{(i) a} symbol, in which case | 176 Each of the @var{bindings} is either @w{(i) a} symbol, in which case |
194 (Z Y)) | 194 (Z Y)) |
195 (list Y Z)) | 195 (list Y Z)) |
196 @result{} (1 2) | 196 @result{} (1 2) |
197 @end group | 197 @end group |
198 @end example | 198 @end example |
199 @end defspec | 199 @end deffn |
200 | 200 |
201 @defspec let* (bindings@dots{}) forms@dots{} | 201 @deffn {Special Operator} let* (bindings@dots{}) forms@dots{} |
202 This special operator is like @code{let}, but it binds each variable right | 202 This special operator is like @code{let}, but it binds each variable right |
203 after computing its local value, before computing the local value for | 203 after computing its local value, before computing the local value for |
204 the next variable. Therefore, an expression in @var{bindings} can | 204 the next variable. Therefore, an expression in @var{bindings} can |
205 reasonably refer to the preceding symbols bound in this @code{let*} | 205 reasonably refer to the preceding symbols bound in this @code{let*} |
206 form. Compare the following example with the example above for | 206 form. Compare the following example with the example above for |
216 (Z Y)) ; @r{Use the just-established value of @code{Y}.} | 216 (Z Y)) ; @r{Use the just-established value of @code{Y}.} |
217 (list Y Z)) | 217 (list Y Z)) |
218 @result{} (1 1) | 218 @result{} (1 1) |
219 @end group | 219 @end group |
220 @end example | 220 @end example |
221 @end defspec | 221 @end deffn |
222 | 222 |
223 Here is a complete list of the other facilities that create local | 223 Here is a complete list of the other facilities that create local |
224 bindings: | 224 bindings: |
225 | 225 |
226 @itemize @bullet | 226 @itemize @bullet |
401 @code{defconst} would override any prior value when the library is | 401 @code{defconst} would override any prior value when the library is |
402 loaded. Users would like to be able to set user options in their init | 402 loaded. Users would like to be able to set user options in their init |
403 files, and override the default values given in the definitions. For | 403 files, and override the default values given in the definitions. For |
404 this reason, user options must be defined with @code{defvar}. | 404 this reason, user options must be defined with @code{defvar}. |
405 | 405 |
406 @defspec defvar symbol [value [doc-string]] | 406 @deffn {Special Operator} defvar symbol [value [doc-string]] |
407 This special operator defines @var{symbol} as a value and initializes it. | 407 This special operator defines @var{symbol} as a value and initializes it. |
408 The definition informs a person reading your code that @var{symbol} is | 408 The definition informs a person reading your code that @var{symbol} is |
409 used as a variable that programs are likely to set or change. It is | 409 used as a variable that programs are likely to set or change. It is |
410 also used for all user option variables except in the preloaded parts of | 410 also used for all user option variables except in the preloaded parts of |
411 XEmacs. Note that @var{symbol} is not evaluated; the symbol to be | 411 XEmacs. Note that @var{symbol} is not evaluated; the symbol to be |
489 @end group | 489 @end group |
490 @end example | 490 @end example |
491 | 491 |
492 The @code{defvar} form returns @var{symbol}, but it is normally used | 492 The @code{defvar} form returns @var{symbol}, but it is normally used |
493 at top level in a file where its value does not matter. | 493 at top level in a file where its value does not matter. |
494 @end defspec | 494 @end deffn |
495 | 495 |
496 @defspec defconst symbol [value [doc-string]] | 496 @deffn {Special Operator} defconst symbol [value [doc-string]] |
497 This special operator defines @var{symbol} as a value and initializes it. | 497 This special operator defines @var{symbol} as a value and initializes it. |
498 It informs a person reading your code that @var{symbol} has a global | 498 It informs a person reading your code that @var{symbol} has a global |
499 value, established here, that will not normally be changed or locally | 499 value, established here, that will not normally be changed or locally |
500 bound by the execution of the program. The user, however, may be | 500 bound by the execution of the program. The user, however, may be |
501 welcome to change it. Note that @var{symbol} is not evaluated; the | 501 welcome to change it. Note that @var{symbol} is not evaluated; the |
528 @group | 528 @group |
529 pi | 529 pi |
530 @result{} 3 | 530 @result{} 3 |
531 @end group | 531 @end group |
532 @end example | 532 @end example |
533 @end defspec | 533 @end deffn |
534 | 534 |
535 @defun user-variable-p variable | 535 @defun user-variable-p variable |
536 @cindex user option | 536 @cindex user option |
537 This function returns @code{t} if @var{variable} is a user option---a | 537 This function returns @code{t} if @var{variable} is a user option---a |
538 variable intended to be set by the user for customization---and | 538 variable intended to be set by the user for customization---and |
613 | 613 |
614 The usual way to change the value of a variable is with the special | 614 The usual way to change the value of a variable is with the special |
615 form @code{setq}. When you need to compute the choice of variable at | 615 form @code{setq}. When you need to compute the choice of variable at |
616 run time, use the function @code{set}. | 616 run time, use the function @code{set}. |
617 | 617 |
618 @defspec setq [symbol form]@dots{} | 618 @deffn {Special Operator} setq [symbol form]@dots{} |
619 This special operator is the most common method of changing a variable's | 619 This special operator is the most common method of changing a variable's |
620 value. Each @var{symbol} is given a new value, which is the result of | 620 value. Each @var{symbol} is given a new value, which is the result of |
621 evaluating the corresponding @var{form}. The most-local existing | 621 evaluating the corresponding @var{form}. The most-local existing |
622 binding of the symbol is changed. | 622 binding of the symbol is changed. |
623 | 623 |
653 (setq x 10 ; @r{Notice that @code{x} is set before} | 653 (setq x 10 ; @r{Notice that @code{x} is set before} |
654 y (1+ x)) ; @r{the value of @code{y} is computed.} | 654 y (1+ x)) ; @r{the value of @code{y} is computed.} |
655 @result{} 11 | 655 @result{} 11 |
656 @end group | 656 @end group |
657 @end example | 657 @end example |
658 @end defspec | 658 @end deffn |
659 | 659 |
660 @defun set symbol value | 660 @defun set symbol value |
661 This function sets @var{symbol}'s value to @var{value}, then returns | 661 This function sets @var{symbol}'s value to @var{value}, then returns |
662 @var{value}. Since @code{set} is a function, the expression written for | 662 @var{value}. Since @code{set} is a function, the expression written for |
663 @var{symbol} is evaluated to obtain the symbol to set. | 663 @var{symbol} is evaluated to obtain the symbol to set. |
1251 | 1251 |
1252 @code{default-boundp} is to @code{default-value} as @code{boundp} is to | 1252 @code{default-boundp} is to @code{default-value} as @code{boundp} is to |
1253 @code{symbol-value}. | 1253 @code{symbol-value}. |
1254 @end defun | 1254 @end defun |
1255 | 1255 |
1256 @defspec setq-default symbol value | 1256 @deffn {Special Operator} setq-default symbol value |
1257 This sets the default value of @var{symbol} to @var{value}. It does not | 1257 This sets the default value of @var{symbol} to @var{value}. It does not |
1258 evaluate @var{symbol}, but does evaluate @var{value}. The value of the | 1258 evaluate @var{symbol}, but does evaluate @var{value}. The value of the |
1259 @code{setq-default} form is @var{value}. | 1259 @code{setq-default} form is @var{value}. |
1260 | 1260 |
1261 If a @var{symbol} is not buffer-local for the current buffer, and is not | 1261 If a @var{symbol} is not buffer-local for the current buffer, and is not |
1312 @result{} value-in-foo | 1312 @result{} value-in-foo |
1313 (default-value 'local) | 1313 (default-value 'local) |
1314 @result{} another-default | 1314 @result{} another-default |
1315 @end group | 1315 @end group |
1316 @end example | 1316 @end example |
1317 @end defspec | 1317 @end deffn |
1318 | 1318 |
1319 @defun set-default symbol value | 1319 @defun set-default symbol value |
1320 This function is like @code{setq-default}, except that @var{symbol} is | 1320 This function is like @code{setq-default}, except that @var{symbol} is |
1321 evaluated. | 1321 evaluated. |
1322 | 1322 |