From: Eli Zaretskii Date: Sun, 19 Oct 2008 13:01:55 +0000 (+0000) Subject: (File Local Variables): Document `file-local-variables-alist', X-Git-Tag: emacs-pretest-23.0.90~2370 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=291703b5c724833ab8cc7e943ddc58f146b4bb1b;p=emacs.git (File Local Variables): Document `file-local-variables-alist', `before-hack-local-variables-hook' and `hack-local-variables-hook'. --- diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog index 619dfcc5a2f..55343fcbdf7 100644 --- a/doc/lispref/ChangeLog +++ b/doc/lispref/ChangeLog @@ -1,5 +1,12 @@ 2008-10-19 Eli Zaretskii + * hooks.texi (Standard Hooks): Mention + `before-hack-local-variables-hook' and `hack-local-variables-hook'. + + * variables.texi (File Local Variables): Document + `file-local-variables-alist', `before-hack-local-variables-hook' + and `hack-local-variables-hook'. + * processes.texi (Synchronous Processes): Document `process-lines'. * customize.texi (Variable Definitions): Document diff --git a/doc/lispref/variables.texi b/doc/lispref/variables.texi index b02bdd8a9fe..9f23ed15616 100644 --- a/doc/lispref/variables.texi +++ b/doc/lispref/variables.texi @@ -1577,12 +1577,38 @@ function does not look for the @samp{mode:} local variable in the @w{@samp{-*-}} line. @code{set-auto-mode} does that, also taking @code{enable-local-variables} into account (@pxref{Auto Major Mode}). +This function works by walking the alist stored in +@code{file-local-variables-alist}, and applies each local variable in +turn. It calls @code{before-hack-local-variables-hook} and +@code{hack-local-variables-hook} before and after applying the +variables, respectively. + If the optional argument @var{mode-only} is non-@code{nil}, then all this function does is return @code{t} if the @w{@samp{-*-}} line or the local variables list specifies a mode and @code{nil} otherwise. It does not set the mode nor any other file local variable. @end defun +@defvar file-local-variables-alist +This buffer-local variable holds the alist of file-local variable +settings. Each element of the alist is of the form +@w{@code{(@var{var} . @var{value})}}, where @var{var} is a symbol of +the local variable and @var{value} is its value. When Emacs visits a +file, it first collects all the file-local variables into this alist, +and then the @code{hack-local-variables} function applies them one by +one. +@end defvar + +@defvar before-hack-local-variables-hook +Emacs calls this hook immediately before applying file-local variables +stored in @code{file-local-variables-alist}. +@end defvar + +@defvar hack-local-variables-hook +Emacs calls this hook immediately after it finishes applying +file-local variables stored in @code{file-local-variables-alist}. +@end defvar + If a file local variable could specify a function that would be called later, or an expression that would be executed later, simply visiting a file could take over your Emacs. Emacs takes several diff --git a/etc/NEWS b/etc/NEWS index 20d71c89c2f..a91f17e101c 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1316,6 +1316,10 @@ unless it ends in whitespace. *** set-file-modes is now interactive and can take the mode value in symbolic notation thanks to auxiliary functions. ++++ +*** file-local-variables-alist stores an alist of file-local +variables defined in the current buffer. + ** Process changes +++ *** The new function `start-file-process' is similar to `start-process', @@ -1391,9 +1395,6 @@ a character code property. *** New variables: -**** file-local-variables-alist stores an alist of file-local -variables defined in the current buffer. - **** `find-word-boundary-function-table' is a char-table of functions to search for a word boundary. @@ -1528,6 +1529,7 @@ which is not used directly any more. *** New hooks: ++++ **** before-hack-local-variables-hook is called after setting new variable file-local-variables-alist, and before actually applying the file-local variables.