Many text editors know how to find magic strings in files that
indicate settings that work best for that file. For example, the file
can indicate that it expects four-character indentation.
In emacs, this magic string is called File Variables. There are two
-*- ... -*- (single-line)
Local Variables:\n...\nEnd: (multi-line).
Both syntaxes allow leading and trailing text on the line.
The single-line syntax must be used on the first line of the file to
be recognized, or on the second line if the first line is a shebang.
The following examples are explicitly allowed by Perl:
#!perl -w -*- cperl -*-
#!perl -w # -*- cperl -*-
#!perl # -*- cperl -*-
The multi-line syntax must be used in the last page (that is, after
the last formfeed) at the end of the file. As of Emacs21, the end of
the file is hard-coded to be the last 3000 bytes of the file (in the
hack-local-variables function in files.el). In this syntax, each line
must begin and end with the same prefix/suffix pair. That pair is
defined by the text before and after the Local Variables: string.
In Emacs, you can view the File Variables info node by typing:
Help-key, i, g, (emacs)File Variables
(where Help-key is often C-h or F1.)
Alternatively, you can execute the following elisp:
(info (emacs)File Variables)