50.2.4 Local Variables in Files

A file can specify local variable values to use when editing the file with Emacs. Visiting the file or setting a major mode checks for local variable specifications; it automatically makes these variables local to the buffer, and sets them to the values specified in the file.

File local variables override directory local variables (see Per-Directory Local Variables), if any are specified for a file’s directory.