diff options
| author | Eli Zaretskii | 2018-01-13 12:48:07 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2018-01-13 12:48:07 +0200 |
| commit | 97b0e41c5d9b4bd81ba35ba7d30d9bd26ec7b145 (patch) | |
| tree | c682258118c39940afb7829dbdeeadd07f8e159e | |
| parent | a502ee9dc4b118074c55cb8e766a9e76e5b466c5 (diff) | |
| download | emacs-97b0e41c5d9b4bd81ba35ba7d30d9bd26ec7b145.tar.gz emacs-97b0e41c5d9b4bd81ba35ba7d30d9bd26ec7b145.zip | |
Improve documentation of safe values of variables
* doc/lispref/variables.texi (File Local Variables): Mention the
autoload cookie as a means of defining safe values for variables.
See http://lists.gnu.org/archive/html/emacs-devel/2018-01/msg00261.html
for the details.
* doc/lispref/compile.texi (Compiler Errors): Document
'byte-compile-error-on-warn'.
| -rw-r--r-- | doc/lispref/compile.texi | 5 | ||||
| -rw-r--r-- | doc/lispref/variables.texi | 15 |
2 files changed, 19 insertions, 1 deletions
diff --git a/doc/lispref/compile.texi b/doc/lispref/compile.texi index 32162c9c22b..212b5a45dc6 100644 --- a/doc/lispref/compile.texi +++ b/doc/lispref/compile.texi | |||
| @@ -524,6 +524,11 @@ one you intend to suppress. | |||
| 524 | the variable @code{byte-compile-warnings}. See its documentation | 524 | the variable @code{byte-compile-warnings}. See its documentation |
| 525 | string for details. | 525 | string for details. |
| 526 | 526 | ||
| 527 | @vindex byte-compile-error-on-warn | ||
| 528 | Sometimes you may wish the byte-compiler warnings to be reported | ||
| 529 | using @code{error}. If so, set @code{byte-compile-error-on-warn} to a | ||
| 530 | non-nil value. | ||
| 531 | |||
| 527 | @node Byte-Code Objects | 532 | @node Byte-Code Objects |
| 528 | @section Byte-Code Function Objects | 533 | @section Byte-Code Function Objects |
| 529 | @cindex compiled function | 534 | @cindex compiled function |
diff --git a/doc/lispref/variables.texi b/doc/lispref/variables.texi index 01cacb0b23c..fe69b7b8e7b 100644 --- a/doc/lispref/variables.texi +++ b/doc/lispref/variables.texi | |||
| @@ -1811,10 +1811,23 @@ variables have @code{safe-local-variable} properties; these include | |||
| 1811 | For boolean-valued variables that are safe, use @code{booleanp} as the | 1811 | For boolean-valued variables that are safe, use @code{booleanp} as the |
| 1812 | property value. | 1812 | property value. |
| 1813 | 1813 | ||
| 1814 | @cindex autoload cookie, and safe values of variable | ||
| 1814 | When defining a user option using @code{defcustom}, you can set its | 1815 | When defining a user option using @code{defcustom}, you can set its |
| 1815 | @code{safe-local-variable} property by adding the arguments | 1816 | @code{safe-local-variable} property by adding the arguments |
| 1816 | @code{:safe @var{function}} to @code{defcustom} (@pxref{Variable | 1817 | @code{:safe @var{function}} to @code{defcustom} (@pxref{Variable |
| 1817 | Definitions}). | 1818 | Definitions}). However, a safety predicate defined using @code{:safe} |
| 1819 | will only be known once the byte-compiler is loaded. As an | ||
| 1820 | alternative, you can use the autoload cookie (@pxref{Autoload}) to | ||
| 1821 | assign the option its safety predicate, like this: | ||
| 1822 | |||
| 1823 | @lisp | ||
| 1824 | ;;;###autoload (put '@var{var} 'safe-local-variable '@var{pred}) | ||
| 1825 | @end lisp | ||
| 1826 | |||
| 1827 | @noindent | ||
| 1828 | The safe value definitions specified with @code{autoload} are copied | ||
| 1829 | into the @file{loaddefs.el} file, and are known to Emacs since the | ||
| 1830 | beginning of a session. | ||
| 1818 | 1831 | ||
| 1819 | @defopt safe-local-variable-values | 1832 | @defopt safe-local-variable-values |
| 1820 | This variable provides another way to mark some variable values as | 1833 | This variable provides another way to mark some variable values as |