Next: , Up: File Modes   [Index]


10.3.1 Normal Mode

If you have changed the major mode of a buffer, you can return to the major mode Emacs would have chosen automatically, by typing ‘M-x normal-mode’. This is the same function that find-file calls to choose the major mode. It also processes the file’s ‘-*-’ line or local variables list (if any).

normal-mode Command

Function: normal-mode &optional find-file

Choose the major mode for this buffer automatically. Also sets up any specified local variables of the file or its directory. Uses the visited file name, the ‘-*-’ line, and the local variables spec.

The command ‘M-x normal-mode’, when used interactively, always obeys file local variable specifications and the ‘-*-’ line, and ignores the variable enable-local-variable.

enable-local-variables is ignored if you run normal-mode interactively, from Lisp without specifying the optional argument ‘FIND-FILE’.

enable-local-variables Variable

Variable: enable-local-variables

Control use of local variables in files you visit. The value can be

t

(default) A value of t means file local variables specifications are obeyed if all the specified variable values are safe; if any values are not safe, Emacs queries you, once, whether to set them all.

nil

means always ignore the file local variables.

:safe

means set the safe variables, and ignore the rest.

:all

means set all variables, whether safe or not.

or something else

Any other value means always query you once whether to set them all.

This variable also controls use of major modes specified in a ‘-*-’ line.


Next: New Major Mode, Up: File Modes   [Index]