diff options
| author | Luc Teirlinck | 2005-05-15 17:33:59 +0000 |
|---|---|---|
| committer | Luc Teirlinck | 2005-05-15 17:33:59 +0000 |
| commit | 0b2892c66e677ebe818d2c60ec28cee9ebd143de (patch) | |
| tree | 230dd1342ef860359d6944758562b09aa416efd2 | |
| parent | ceea381865b488578e413659fa17398550e4382a (diff) | |
| download | emacs-0b2892c66e677ebe818d2c60ec28cee9ebd143de.tar.gz emacs-0b2892c66e677ebe818d2c60ec28cee9ebd143de.zip | |
Reorder nodes.
(Variables): Update menu.
| -rw-r--r-- | lispref/variables.texi | 174 |
1 files changed, 87 insertions, 87 deletions
diff --git a/lispref/variables.texi b/lispref/variables.texi index 6040a4c09ae..27f0f4a7029 100644 --- a/lispref/variables.texi +++ b/lispref/variables.texi | |||
| @@ -42,8 +42,8 @@ variable. | |||
| 42 | * Buffer-Local Variables:: Variable values in effect only in one buffer. | 42 | * Buffer-Local Variables:: Variable values in effect only in one buffer. |
| 43 | * Frame-Local Variables:: Variable values in effect only in one frame. | 43 | * Frame-Local Variables:: Variable values in effect only in one frame. |
| 44 | * Future Local Variables:: New kinds of local values we might add some day. | 44 | * Future Local Variables:: New kinds of local values we might add some day. |
| 45 | * Variable Aliases:: Variables that are aliases for other variables. | ||
| 46 | * File Local Variables:: Handling local variable lists in files. | 45 | * File Local Variables:: Handling local variable lists in files. |
| 46 | * Variable Aliases:: Variables that are aliases for other variables. | ||
| 47 | * Variables with Restricted Values:: Non-constant variables whose value can | 47 | * Variables with Restricted Values:: Non-constant variables whose value can |
| 48 | @emph{not} be an arbitrary Lisp object. | 48 | @emph{not} be an arbitrary Lisp object. |
| 49 | @end menu | 49 | @end menu |
| @@ -1688,6 +1688,92 @@ bindings offer a way to handle these situations more robustly. | |||
| 1688 | If sufficient application is found for either of these two kinds of | 1688 | If sufficient application is found for either of these two kinds of |
| 1689 | local bindings, we will provide it in a subsequent Emacs version. | 1689 | local bindings, we will provide it in a subsequent Emacs version. |
| 1690 | 1690 | ||
| 1691 | @node File Local Variables | ||
| 1692 | @section File Local Variables | ||
| 1693 | |||
| 1694 | This section describes the functions and variables that affect | ||
| 1695 | processing of file local variables. @xref{File variables, , | ||
| 1696 | Local Variables in Files, emacs, The GNU Emacs Manual}, for basic | ||
| 1697 | information about file local variables. | ||
| 1698 | |||
| 1699 | @defopt enable-local-variables | ||
| 1700 | This variable controls whether to process file local variables. A | ||
| 1701 | value of @code{t} means process them unconditionally; @code{nil} means | ||
| 1702 | ignore them; anything else means ask the user what to do for each | ||
| 1703 | file. The default value is @code{t}. | ||
| 1704 | @end defopt | ||
| 1705 | |||
| 1706 | @defun hack-local-variables &optional mode-only | ||
| 1707 | This function parses, and binds or evaluates as appropriate, any local | ||
| 1708 | variables specified by the contents of the current buffer. The variable | ||
| 1709 | @code{enable-local-variables} has its effect here. However, this | ||
| 1710 | function does not look for the @samp{mode:} local variable in the | ||
| 1711 | @w{@samp{-*-}} line. @code{set-auto-mode} does that, also taking | ||
| 1712 | @code{enable-local-variables} into account (@pxref{Auto Major Mode}). | ||
| 1713 | |||
| 1714 | If the optional argument @var{mode-only} is non-@code{nil}, then all | ||
| 1715 | this function does is return @code{t} if the @w{@samp{-*-}} line or | ||
| 1716 | the local variables list specifies a mode and @code{nil} otherwise. | ||
| 1717 | It does not set the mode nor any other file local variable. | ||
| 1718 | @end defun | ||
| 1719 | |||
| 1720 | If a file local variable could specify a function that would | ||
| 1721 | be called later, or an expression that would be executed later, simply | ||
| 1722 | visiting a file could take over your Emacs. To prevent this, Emacs | ||
| 1723 | takes care not to allow to set such file local variables. | ||
| 1724 | |||
| 1725 | For one thing, any variable whose name ends in @samp{-command}, | ||
| 1726 | @samp{-frame-alist}, @samp{-function}, @samp{-functions}, | ||
| 1727 | @samp{-hook}, @samp{-hooks}, @samp{-form}, @samp{-forms}, @samp{-map}, | ||
| 1728 | @samp{-map-alist}, @samp{-mode-alist}, @samp{-program}, or | ||
| 1729 | @samp{-predicate} cannot be given a file local value. In general, | ||
| 1730 | you should use such a name whenever it is appropriate for the | ||
| 1731 | variable's meaning. The variables @samp{font-lock-keywords}, | ||
| 1732 | @samp{font-lock-keywords-[0-9]}, and | ||
| 1733 | @samp{font-lock-syntactic-keywords} cannot be given file local values either. | ||
| 1734 | These rules can be overridden by giving the variable's | ||
| 1735 | name a non-@code{nil} @code{safe-local-variable} property. If one | ||
| 1736 | gives it a @code{safe-local-variable} property of @code{t}, then one | ||
| 1737 | can give the variable any file local value. One can also give any | ||
| 1738 | symbol, including the above, a @code{safe-local-variable} property | ||
| 1739 | that is a function taking exactly one argument. In that case, giving | ||
| 1740 | a variable with that name a file local value is only allowed if the | ||
| 1741 | function returns non-@code{nil} when called with that value as | ||
| 1742 | argument. | ||
| 1743 | |||
| 1744 | In addition, any variable whose name has a non-@code{nil} | ||
| 1745 | @code{risky-local-variable} property is also ignored. So are all | ||
| 1746 | variables listed in @code{ignored-local-variables}: | ||
| 1747 | |||
| 1748 | @defvar ignored-local-variables | ||
| 1749 | This variable holds a list of variables that should not be given local | ||
| 1750 | values by files. Any value specified for one of these variables is | ||
| 1751 | ignored. | ||
| 1752 | @end defvar | ||
| 1753 | |||
| 1754 | @defun risky-local-variable-p sym &optional val | ||
| 1755 | If @var{val} is non-@code{nil}, returns non-@code{nil} if giving | ||
| 1756 | @var{sym} a file local value of @var{val} would be risky, for any of | ||
| 1757 | the reasons stated above. If @var{val} is @code{nil} or omitted, only | ||
| 1758 | returns @code{nil} if @var{sym} can be safely assigned any file local | ||
| 1759 | value whatsoever. | ||
| 1760 | @end defun | ||
| 1761 | |||
| 1762 | The @samp{Eval:} ``variable'' is also a potential loophole, so Emacs | ||
| 1763 | normally asks for confirmation before handling it. | ||
| 1764 | |||
| 1765 | @defopt enable-local-eval | ||
| 1766 | This variable controls processing of @samp{Eval:} in @samp{-*-} lines | ||
| 1767 | or local variables | ||
| 1768 | lists in files being visited. A value of @code{t} means process them | ||
| 1769 | unconditionally; @code{nil} means ignore them; anything else means ask | ||
| 1770 | the user what to do for each file. The default value is @code{maybe}. | ||
| 1771 | @end defopt | ||
| 1772 | |||
| 1773 | Text properties are also potential loopholes, since their values | ||
| 1774 | could include functions to call. So Emacs discards all text | ||
| 1775 | properties from string values specified for file local variables. | ||
| 1776 | |||
| 1691 | @node Variable Aliases | 1777 | @node Variable Aliases |
| 1692 | @section Variable Aliases | 1778 | @section Variable Aliases |
| 1693 | 1779 | ||
| @@ -1780,92 +1866,6 @@ foo | |||
| 1780 | @result{} 0 | 1866 | @result{} 0 |
| 1781 | @end example | 1867 | @end example |
| 1782 | 1868 | ||
| 1783 | @node File Local Variables | ||
| 1784 | @section File Local Variables | ||
| 1785 | |||
| 1786 | This section describes the functions and variables that affect | ||
| 1787 | processing of file local variables. @xref{File variables, , | ||
| 1788 | Local Variables in Files, emacs, The GNU Emacs Manual}, for basic | ||
| 1789 | information about file local variables. | ||
| 1790 | |||
| 1791 | @defopt enable-local-variables | ||
| 1792 | This variable controls whether to process file local variables. A | ||
| 1793 | value of @code{t} means process them unconditionally; @code{nil} means | ||
| 1794 | ignore them; anything else means ask the user what to do for each | ||
| 1795 | file. The default value is @code{t}. | ||
| 1796 | @end defopt | ||
| 1797 | |||
| 1798 | @defun hack-local-variables &optional mode-only | ||
| 1799 | This function parses, and binds or evaluates as appropriate, any local | ||
| 1800 | variables specified by the contents of the current buffer. The variable | ||
| 1801 | @code{enable-local-variables} has its effect here. However, this | ||
| 1802 | function does not look for the @samp{mode:} local variable in the | ||
| 1803 | @w{@samp{-*-}} line. @code{set-auto-mode} does that, also taking | ||
| 1804 | @code{enable-local-variables} into account (@pxref{Auto Major Mode}). | ||
| 1805 | |||
| 1806 | If the optional argument @var{mode-only} is non-@code{nil}, then all | ||
| 1807 | this function does is return @code{t} if the @w{@samp{-*-}} line or | ||
| 1808 | the local variables list specifies a mode and @code{nil} otherwise. | ||
| 1809 | It does not set the mode nor any other file local variable. | ||
| 1810 | @end defun | ||
| 1811 | |||
| 1812 | If a file local variable could specify a function that would | ||
| 1813 | be called later, or an expression that would be executed later, simply | ||
| 1814 | visiting a file could take over your Emacs. To prevent this, Emacs | ||
| 1815 | takes care not to allow to set such file local variables. | ||
| 1816 | |||
| 1817 | For one thing, any variable whose name ends in @samp{-command}, | ||
| 1818 | @samp{-frame-alist}, @samp{-function}, @samp{-functions}, | ||
| 1819 | @samp{-hook}, @samp{-hooks}, @samp{-form}, @samp{-forms}, @samp{-map}, | ||
| 1820 | @samp{-map-alist}, @samp{-mode-alist}, @samp{-program}, or | ||
| 1821 | @samp{-predicate} cannot be given a file local value. In general, | ||
| 1822 | you should use such a name whenever it is appropriate for the | ||
| 1823 | variable's meaning. The variables @samp{font-lock-keywords}, | ||
| 1824 | @samp{font-lock-keywords-[0-9]}, and | ||
| 1825 | @samp{font-lock-syntactic-keywords} cannot be given file local values either. | ||
| 1826 | These rules can be overridden by giving the variable's | ||
| 1827 | name a non-@code{nil} @code{safe-local-variable} property. If one | ||
| 1828 | gives it a @code{safe-local-variable} property of @code{t}, then one | ||
| 1829 | can give the variable any file local value. One can also give any | ||
| 1830 | symbol, including the above, a @code{safe-local-variable} property | ||
| 1831 | that is a function taking exactly one argument. In that case, giving | ||
| 1832 | a variable with that name a file local value is only allowed if the | ||
| 1833 | function returns non-@code{nil} when called with that value as | ||
| 1834 | argument. | ||
| 1835 | |||
| 1836 | In addition, any variable whose name has a non-@code{nil} | ||
| 1837 | @code{risky-local-variable} property is also ignored. So are all | ||
| 1838 | variables listed in @code{ignored-local-variables}: | ||
| 1839 | |||
| 1840 | @defvar ignored-local-variables | ||
| 1841 | This variable holds a list of variables that should not be given local | ||
| 1842 | values by files. Any value specified for one of these variables is | ||
| 1843 | ignored. | ||
| 1844 | @end defvar | ||
| 1845 | |||
| 1846 | @defun risky-local-variable-p sym &optional val | ||
| 1847 | If @var{val} is non-@code{nil}, returns non-@code{nil} if giving | ||
| 1848 | @var{sym} a file local value of @var{val} would be risky, for any of | ||
| 1849 | the reasons stated above. If @var{val} is @code{nil} or omitted, only | ||
| 1850 | returns @code{nil} if @var{sym} can be safely assigned any file local | ||
| 1851 | value whatsoever. | ||
| 1852 | @end defun | ||
| 1853 | |||
| 1854 | The @samp{Eval:} ``variable'' is also a potential loophole, so Emacs | ||
| 1855 | normally asks for confirmation before handling it. | ||
| 1856 | |||
| 1857 | @defopt enable-local-eval | ||
| 1858 | This variable controls processing of @samp{Eval:} in @samp{-*-} lines | ||
| 1859 | or local variables | ||
| 1860 | lists in files being visited. A value of @code{t} means process them | ||
| 1861 | unconditionally; @code{nil} means ignore them; anything else means ask | ||
| 1862 | the user what to do for each file. The default value is @code{maybe}. | ||
| 1863 | @end defopt | ||
| 1864 | |||
| 1865 | Text properties are also potential loopholes, since their values | ||
| 1866 | could include functions to call. So Emacs discards all text | ||
| 1867 | properties from string values specified for file local variables. | ||
| 1868 | |||
| 1869 | @node Variables with Restricted Values | 1869 | @node Variables with Restricted Values |
| 1870 | @section Variables with Restricted Values | 1870 | @section Variables with Restricted Values |
| 1871 | 1871 | ||