Go to the first, previous, next, last section, table of contents.


File Variables

It is often useful to define `local' values of certain variables which only come into effect when a particular file is being edited. Jade allows you to include a special section in a file which, when the file is loaded, is used to give the variables specified buffer-local values. (For more information about buffer-local variables see section Buffer-Local Variables.)

The special section must be somewhere in the last twenty lines of a file, and must be formatted as in the following example,

XXX Local Variables: YYY
XXX variable:value YYY
...
XXX End: YYY

That is, the string `Local Variables:' followed by as many lines defining local values as necessary then the string `End:'. The two strings `XXX' and `YYY' may be anything (even nothing!) as long as they are the same on each line. They are normally used to put the local variable section into a comment in a source file.

For example, in a Texinfo source file the following piece of text at the bottom of the file would set the column at which lines are broken to 74 (note that `@c' introduces a comment in Texinfo).

@c Local Variables:
@c fill-column:74
@c End:

Two pseudo-variables which can be set using a local variables section are `mode' and `eval'. Setting the `mode' variable actually defines the major mode to use with the file (see section Editing Modes) while setting `eval' actually evaluates the Lisp form VALUE then discards its value.

For example,

/* Local Variables: */
/* mode:C */
/* eval:(message "How pointless!") */
/* End: */

This Forces the file to be edited with the C mode and displays a pointless message. Note that no variables called mode or eval are actually set.

Several variables are used to control how the local variables feature works.

Variable: enable-local-variables
Defines how to process the `Local Variables:' section of a file: nil means to ignore it, t means process it as normal and anything else means that each variable being set has to be confirmed by the user. Its default value it t.

Variable: enable-local-eval
This variable defines how the pseudo-variable `eval' is treated in a local variables list, it works in the same way as the enable-local-variables variable does. Its default value is maybe, making each form be confirmed before being evaluated.

Variable: local-variable-lines
Defines how many lines at the bottom of a file are scanned for the `Local Variables:' marker, by default it is 20.

Note that this feature is compatible with GNU Emacs, and since I have tried to keep the names of variables compatible as well, there should be few problems.


Go to the first, previous, next, last section, table of contents.