Local Variables in Files
A file can specify local variable values for use when you edit the file with Emacs. Visiting the file checks for local variable specifications; it automatically makes these variables local to the buffer, and sets them to the values specified in the file.
There are two ways to specify local variable values: in the first line, or with a local variables list. Here's how to specify them in the first line:
-*- mode: modename; var: value; ... -*-
You can specify any number of variables/value pairs in this way, each pair with a colon and semicolon as shown above. mode: modename; specifies the major mode; this should come first in the line. The values are not evaluated; they are used literally. Here is an example that specifies Lisp mode and sets two variables with numeric values:
;; -*- mode: Lisp; fill-column: 75; comment-column: 50; -*-
You can also specify the coding system for a file in this way: just specify a value for the "variable" named coding. The "value" must be a coding system name that Emacs recognizes. See Coding Systems.
The eval pseudo-variable, described below, can be specified in the first line as well.
In shell scripts, the first line is used to identify the script interpreter, so you cannot put any local variables there. To accommodate for this, when Emacs visits a shell script, it looks for local variable specifications in the second line.
A local variables list goes near the end of the file, in the last page. (It is often best to put it on a page by itself.) The local variables list starts with a line containing the string Local Variables:, and ends with a line containing the string End:. In between come the variable names and values, one set per line, as variable: value. The values are not evaluated; they are used literally. If a file has both a local variables list and a -*- line, Emacs processes everything in the -*- line first, and everything in the local variables list afterward.
Here is an example of a local variables list:
;;; Local Variables: *** ;;; mode:lisp *** ;;; comment-column:0 *** ;;; comment-start: ";;; " *** ;;; comment-end:"***" *** ;;; End: ***
As you see, each line starts with the prefix ;;; and each line ends with the suffix ***. Emacs recognizes these as the prefix and suffix based on the first line of the list, by finding them surrounding the magic string Local Variables:; then it automatically discards them from the other lines of the list.
The usual reason for using a prefix and/or suffix is to embed the local variables list in a comment, so it won't confuse other programs that the file is intended as input for. The example above is for a language where comment lines start with ;;; and end with ***; the local values for comment-start and comment-end customize the rest of Emacs for this unusual syntax. Don't use a prefix (or a suffix) if you don't need one.
Two "variable names" have

