diff options
| author | Luc Teirlinck | 2003-12-25 03:49:55 +0000 |
|---|---|---|
| committer | Luc Teirlinck | 2003-12-25 03:49:55 +0000 |
| commit | 74ab3aa34adc0dc51e825e22fed1be7f89a09fbf (patch) | |
| tree | bfb0db6c86871a9368f3af003703c741ed10b010 | |
| parent | b51785c1212fceae6491be5e670dc4f935d91cde (diff) | |
| download | emacs-74ab3aa34adc0dc51e825e22fed1be7f89a09fbf.tar.gz emacs-74ab3aa34adc0dc51e825e22fed1be7f89a09fbf.zip | |
(Variables with Restricted Values): New node.
| -rw-r--r-- | lispref/variables.texi | 47 |
1 files changed, 43 insertions, 4 deletions
diff --git a/lispref/variables.texi b/lispref/variables.texi index 36cc2e47fe4..bbe7358b5d7 100644 --- a/lispref/variables.texi +++ b/lispref/variables.texi | |||
| @@ -43,6 +43,8 @@ variable. | |||
| 43 | * Future Local Variables:: New kinds of local values we might add some day. | 43 | * Future Local Variables:: New kinds of local values we might add some day. |
| 44 | * Variable Aliases:: Variables that are aliases for other variables. | 44 | * Variable Aliases:: Variables that are aliases for other variables. |
| 45 | * File Local Variables:: Handling local variable lists in files. | 45 | * File Local Variables:: Handling local variable lists in files. |
| 46 | * Variables with Restricted Values:: Non-constant variables whose value can | ||
| 47 | @emph{not} be an arbitrary Lisp object. | ||
| 46 | @end menu | 48 | @end menu |
| 47 | 49 | ||
| 48 | @node Global Variables | 50 | @node Global Variables |
| @@ -258,19 +260,21 @@ These kinds of bindings work somewhat like ordinary local bindings, but | |||
| 258 | they are localized depending on ``where'' you are in Emacs, rather than | 260 | they are localized depending on ``where'' you are in Emacs, rather than |
| 259 | localized in time. | 261 | localized in time. |
| 260 | 262 | ||
| 263 | @anchor{Definition of max-specpdl-size} | ||
| 261 | @defvar max-specpdl-size | 264 | @defvar max-specpdl-size |
| 262 | @cindex variable limit error | 265 | @cindex variable limit error |
| 263 | @cindex evaluation error | 266 | @cindex evaluation error |
| 264 | @cindex infinite recursion | 267 | @cindex infinite recursion |
| 265 | This variable defines the limit on the total number of local variable | 268 | This variable defines the limit on the total number of local variable |
| 266 | bindings and @code{unwind-protect} cleanups (@pxref{Nonlocal Exits}) | 269 | bindings and @code{unwind-protect} cleanups (@pxref{Cleanups,, |
| 267 | that are allowed before signaling an error (with data @code{"Variable | 270 | Cleaning Up from Nonlocal Exits}) that are allowed before signaling an |
| 268 | binding depth exceeds max-specpdl-size"}). | 271 | error (with data @code{"Variable binding depth exceeds |
| 272 | max-specpdl-size"}). | ||
| 269 | 273 | ||
| 270 | This limit, with the associated error when it is exceeded, is one way | 274 | This limit, with the associated error when it is exceeded, is one way |
| 271 | that Lisp avoids infinite recursion on an ill-defined function. | 275 | that Lisp avoids infinite recursion on an ill-defined function. |
| 272 | @code{max-lisp-eval-depth} provides another limit on depth of nesting. | 276 | @code{max-lisp-eval-depth} provides another limit on depth of nesting. |
| 273 | @xref{Eval}. | 277 | @xref{Definition of max-lisp-eval-depth,, Eval}. |
| 274 | 278 | ||
| 275 | The default value is 600. Entry to the Lisp debugger increases the | 279 | The default value is 600. Entry to the Lisp debugger increases the |
| 276 | value, if there is little room left, to make sure the debugger itself | 280 | value, if there is little room left, to make sure the debugger itself |
| @@ -1813,6 +1817,41 @@ could include functions to call. So Emacs discards all text | |||
| 1813 | properties from string values specified in a file's local variables | 1817 | properties from string values specified in a file's local variables |
| 1814 | list. | 1818 | list. |
| 1815 | 1819 | ||
| 1820 | @node Variables with Restricted Values | ||
| 1821 | @section Variables with Restricted Values | ||
| 1822 | |||
| 1823 | Ordinary Lisp variables can be assigned any value that is a valid | ||
| 1824 | Lisp object. However, certain Lisp variables are not defined in Lisp, | ||
| 1825 | but in C. Most of these variables are defined in the C code using | ||
| 1826 | @code{DEFVAR_LISP}. Like variables defined in Lisp, these can take on | ||
| 1827 | any value. However, some variables are defined using | ||
| 1828 | @code{DEFVAR_INT} or @code{DEFVAR_BOOL}. @xref{Defining Lisp | ||
| 1829 | variables in C,, Writing Emacs Primitives}, in particular the | ||
| 1830 | description of functions of the type @code{syms_of_@var{filename}}, | ||
| 1831 | for a brief discussion of the C implementation. | ||
| 1832 | |||
| 1833 | Variables of type @code{DEFVAR_BOOL} can only take on the values | ||
| 1834 | @code{nil} or @code{t}. Attempting to assign them any other value | ||
| 1835 | will set them to @code{t}: | ||
| 1836 | |||
| 1837 | @example | ||
| 1838 | (let ((display-hourglass 5)) | ||
| 1839 | display-hourglass) | ||
| 1840 | @result{} t | ||
| 1841 | @end example | ||
| 1842 | |||
| 1843 | @defvar byte-boolean-vars | ||
| 1844 | This variable holds a list of all variables of type @code{DEFVAR_BOOL}. | ||
| 1845 | @end defvar | ||
| 1846 | |||
| 1847 | Variables of type @code{DEFVAR_INT} can only take on integer values. | ||
| 1848 | Attempting to assign them any other value will result in an error: | ||
| 1849 | |||
| 1850 | @example | ||
| 1851 | (setq window-min-height 5.0) | ||
| 1852 | @error{} Wrong type argument: integerp, 5.0 | ||
| 1853 | @end example | ||
| 1854 | |||
| 1816 | @ignore | 1855 | @ignore |
| 1817 | arch-tag: 5ff62c44-2b51-47bb-99d4-fea5aeec5d3e | 1856 | arch-tag: 5ff62c44-2b51-47bb-99d4-fea5aeec5d3e |
| 1818 | @end ignore | 1857 | @end ignore |