Mercurial > emacs
comparison lispref/variables.texi @ 62365:69b2883d6502
(File Local Variables): Do not refer to the `-*-' line as
a "local variables list". Add pxref.
author | Luc Teirlinck <teirllm@auburn.edu> |
---|---|
date | Sun, 15 May 2005 16:53:06 +0000 |
parents | a89efed2c3f0 |
children | fbbfd824228f |
comparison
equal
deleted
inserted
replaced
62364:55c2e9c1c3cb | 62365:69b2883d6502 |
---|---|
1782 | 1782 |
1783 @node File Local Variables | 1783 @node File Local Variables |
1784 @section File Local Variables | 1784 @section File Local Variables |
1785 | 1785 |
1786 This section describes the functions and variables that affect | 1786 This section describes the functions and variables that affect |
1787 processing of local variables lists in files. @xref{File variables, , | 1787 processing of file local variables. @xref{File variables, , |
1788 Local Variables in Files, emacs, The GNU Emacs Manual}, for basic | 1788 Local Variables in Files, emacs, The GNU Emacs Manual}, for basic |
1789 information about file local variables. | 1789 information about file local variables. |
1790 | 1790 |
1791 @defopt enable-local-variables | 1791 @defopt enable-local-variables |
1792 This variable controls whether to process file local variables lists. A | 1792 This variable controls whether to process file local variables. A |
1793 value of @code{t} means process the local variables lists | 1793 value of @code{t} means process them unconditionally; @code{nil} means |
1794 unconditionally; @code{nil} means ignore them; anything else means ask | 1794 ignore them; anything else means ask the user what to do for each |
1795 the user what to do for each file. The default value is @code{t}. | 1795 file. The default value is @code{t}. |
1796 @end defopt | 1796 @end defopt |
1797 | 1797 |
1798 @defun hack-local-variables &optional mode-only | 1798 @defun hack-local-variables &optional mode-only |
1799 This function parses, and binds or evaluates as appropriate, any local | 1799 This function parses, and binds or evaluates as appropriate, any local |
1800 variables specified by the contents of the current buffer. The variable | 1800 variables specified by the contents of the current buffer. The variable |
1801 @code{enable-local-variables} has its effect here. However, this | 1801 @code{enable-local-variables} has its effect here. However, this |
1802 function does not look for the @samp{mode:} local variable in the | 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 | 1803 @w{@samp{-*-}} line. @code{set-auto-mode} does that, also taking |
1804 @code{enable-local-variables} into account. | 1804 @code{enable-local-variables} into account (@pxref{Auto Major Mode}). |
1805 | 1805 |
1806 If the optional argument @var{mode-only} is non-@code{nil}, then all | 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 | 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. | 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. | 1809 It does not set the mode nor any other file local variable. |
1810 @end defun | 1810 @end defun |
1811 | 1811 |
1812 If a file local variable list could specify a function that would | 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 | 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 | 1814 visiting a file could take over your Emacs. To prevent this, Emacs |
1815 takes care not to allow local variable lists to set such variables. | 1815 takes care not to allow to set such file local variables. |
1816 | 1816 |
1817 For one thing, any variable whose name ends in @samp{-command}, | 1817 For one thing, any variable whose name ends in @samp{-command}, |
1818 @samp{-frame-alist}, @samp{-function}, @samp{-functions}, | 1818 @samp{-frame-alist}, @samp{-function}, @samp{-functions}, |
1819 @samp{-hook}, @samp{-hooks}, @samp{-form}, @samp{-forms}, @samp{-map}, | 1819 @samp{-hook}, @samp{-hooks}, @samp{-form}, @samp{-forms}, @samp{-map}, |
1820 @samp{-map-alist}, @samp{-mode-alist}, @samp{-program}, or | 1820 @samp{-map-alist}, @samp{-mode-alist}, @samp{-program}, or |
1821 @samp{-predicate} cannot be set in a local variable list. In general, | 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 | 1822 you should use such a name whenever it is appropriate for the |
1823 variable's meaning. The variables @samp{font-lock-keywords}, | 1823 variable's meaning. The variables @samp{font-lock-keywords}, |
1824 @samp{font-lock-keywords-[0-9]}, and | 1824 @samp{font-lock-keywords-[0-9]}, and |
1825 @samp{font-lock-syntactic-keywords} cannot be set in a local variable | 1825 @samp{font-lock-syntactic-keywords} cannot be given file local values either. |
1826 list, either. These rules can be overridden by giving the variable's | 1826 These rules can be overridden by giving the variable's |
1827 name a non-@code{nil} @code{safe-local-variable} property. If one | 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 | 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 | 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 | 1830 symbol, including the above, a @code{safe-local-variable} property |
1831 that is a function taking exactly one argument. In that case, giving | 1831 that is a function taking exactly one argument. In that case, giving |
1836 In addition, any variable whose name has a non-@code{nil} | 1836 In addition, any variable whose name has a non-@code{nil} |
1837 @code{risky-local-variable} property is also ignored. So are all | 1837 @code{risky-local-variable} property is also ignored. So are all |
1838 variables listed in @code{ignored-local-variables}: | 1838 variables listed in @code{ignored-local-variables}: |
1839 | 1839 |
1840 @defvar ignored-local-variables | 1840 @defvar ignored-local-variables |
1841 This variable holds a list of variables that should not be | 1841 This variable holds a list of variables that should not be given local |
1842 set by a file's local variables list. Any value specified | 1842 values by files. Any value specified for one of these variables is |
1843 for one of these variables is ignored. | 1843 ignored. |
1844 @end defvar | 1844 @end defvar |
1845 | 1845 |
1846 @defun risky-local-variable-p sym &optional val | 1846 @defun risky-local-variable-p sym &optional val |
1847 If @var{val} is non-@code{nil}, returns non-@code{nil} if giving | 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 | 1848 @var{sym} a file local value of @var{val} would be risky, for any of |
1853 | 1853 |
1854 The @samp{Eval:} ``variable'' is also a potential loophole, so Emacs | 1854 The @samp{Eval:} ``variable'' is also a potential loophole, so Emacs |
1855 normally asks for confirmation before handling it. | 1855 normally asks for confirmation before handling it. |
1856 | 1856 |
1857 @defopt enable-local-eval | 1857 @defopt enable-local-eval |
1858 This variable controls processing of @samp{Eval:} in local variables | 1858 This variable controls processing of @samp{Eval:} in @samp{-*-} lines |
1859 or local variables | |
1859 lists in files being visited. A value of @code{t} means process them | 1860 lists in files being visited. A value of @code{t} means process them |
1860 unconditionally; @code{nil} means ignore them; anything else means ask | 1861 unconditionally; @code{nil} means ignore them; anything else means ask |
1861 the user what to do for each file. The default value is @code{maybe}. | 1862 the user what to do for each file. The default value is @code{maybe}. |
1862 @end defopt | 1863 @end defopt |
1863 | 1864 |
1864 Text properties are also potential loopholes, since their values | 1865 Text properties are also potential loopholes, since their values |
1865 could include functions to call. So Emacs discards all text | 1866 could include functions to call. So Emacs discards all text |
1866 properties from string values specified in a file's local variables | 1867 properties from string values specified for file local variables. |
1867 list. | |
1868 | 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 |
1872 Ordinary Lisp variables can be assigned any value that is a valid | 1872 Ordinary Lisp variables can be assigned any value that is a valid |