www.delorie.com/gnu/docs/elisp-manual-21/elisp_158.html   search  
 
Buy the book!


GNU Emacs Lisp Reference Manual

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

11.13 File Local Variables

This section describes the functions and variables that affect processing of local variables lists in files.

User Option: enable-local-variables
This variable controls whether to process file local variables lists. A value of t means process the local variables lists unconditionally; nil means ignore them; anything else means ask the user what to do for each file. The default value is t.

Function: hack-local-variables &optional force
This function parses, and binds or evaluates as appropriate, any local variables specified by the contents of the current buffer. The variable enable-local-variables has its effect here.

The argument force usually comes from the argument find-file given to normal-mode.

If a file local variable list could specify the a function that will be called later, or an expression that will be executed later, simply visiting a file could take over your Emacs. To prevent this, Emacs takes care not to allow local variable lists to set such variables.

For one thing, any variable whose name ends in `-function', `-functions', `-hook', `-hooks', `-form', `-forms', `-program', `-command' or `-predicate' cannot be set in a local variable list. In general, you should use such a name whenever it is appropriate for the variable's meaning.

In addition, any variable whose name has a non-nil risky-local-variable property is also ignored. So are all variables listed in ignored-local-variables:

Variable: ignored-local-variables
This variable holds a list of variables that should not be set by a file's local variables list. Any value specified for one of these variables is ignored.

The `Eval:' "variable" is also a potential loophole, so Emacs normally asks for confirmation before handling it.

User Option: enable-local-eval
This variable controls processing of `Eval:' in local variables lists in files being visited. A value of t means process them unconditionally; nil means ignore them; anything else means ask the user what to do for each file. The default value is maybe.

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

  webmaster   donations   bookstore     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003