Correct some outdated docs for hack-local-variables
* doc/lispref/variables.texi (File Local Variables): <hack-local-variables>: Say that it applies directory-local variables too. Add a cross-reference. (Directory Local Variables): Document dir-local-variables-alist. * lisp/files.el (hack-local-variables): Say that it always puts into effect directory-local variables.
This commit is contained in:
parent
c877acc261
commit
2029104605
2 changed files with 30 additions and 10 deletions
|
@ -2014,14 +2014,21 @@ 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 applying each local variable in
|
||||
turn. It calls @code{before-hack-local-variables-hook} and
|
||||
This function also puts into effect directory-local variables as
|
||||
specified in @file{.dir-locals.el}. If the buffer is not visiting any
|
||||
file, then the directory-local variables that apply are those which
|
||||
would be applicable to files in the @code{default-directory}
|
||||
(@pxref{Directory Local Variables}).
|
||||
|
||||
This function works by walking the alists stored in
|
||||
@code{file-local-variables-alist} and @code{dir-local-variables-alist}
|
||||
and applying 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. It only calls the before-hook if the alist
|
||||
is non-@code{nil}; it always calls the other hook. This
|
||||
function ignores a @samp{mode} element if it specifies the same major
|
||||
mode as the buffer already has.
|
||||
variables, respectively. It only calls the before-hook if
|
||||
@code{file-local-variables-alist} is non-@code{nil}; it always calls the
|
||||
other hook. This function ignores a @samp{mode} element if it specifies
|
||||
the same major mode as the buffer already has.
|
||||
|
||||
If the optional argument @var{handle-mode} is @code{t}, then all this
|
||||
function does is return a symbol specifying the major mode, if the
|
||||
|
@ -2288,6 +2295,17 @@ modification times of the associated directory local variables file
|
|||
updates this list.
|
||||
@end defvar
|
||||
|
||||
@defvar dir-local-variables-alist
|
||||
This buffer-local variable holds the alist of directory-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 (this is the same structure as that of
|
||||
@code{file-local-variables-alist}, @pxref{File Local Variables}). When
|
||||
Emacs visits a file, it collects all the directory-local variables into
|
||||
this alist, and then the @code{hack-local-variables} function applies
|
||||
them one by one (again, @pxref{File Local Variables}).
|
||||
@end defvar
|
||||
|
||||
@defvar hack-dir-local-get-variables-functions
|
||||
This special hook holds the functions that gather the directory-local
|
||||
variables to use for a given buffer. By default it contains just the
|
||||
|
|
|
@ -4163,10 +4163,12 @@ DIR-NAME is the name of the associated directory. Otherwise it is nil."
|
|||
|
||||
(defun hack-local-variables (&optional handle-mode inhibit-locals)
|
||||
"Parse and put into effect this buffer's local variables spec.
|
||||
For buffers visiting files, also puts into effect directory-local
|
||||
variables.
|
||||
Also puts into effect directory-local variables.
|
||||
For buffers not visiting files, apply the directory-local variables that
|
||||
would be applicable to files in `default-directory'.
|
||||
|
||||
Uses `hack-local-variables-apply' to apply the variables.
|
||||
Uses `hack-local-variables-apply' and `hack-dir-local-variables'
|
||||
to apply the variables.
|
||||
|
||||
If `enable-local-variables' or `local-enable-local-variables' is
|
||||
nil, or INHIBIT-LOCALS is non-nil, this function disregards all
|
||||
|
|
Loading…
Add table
Reference in a new issue