Is there a built in way in emacs to to suggest what mode it should use? I have lots of properties files that doesn't have a file endings to guide emacs.

Ideally I'd like to be able to put somthing like this in the file header

# Emacs-Mode: <name of mode wanted>

1 Answer 1


You mean like this:

-*- mode: outline -*-

There are two methods of doing this. In the first one, Emacs reads the first line of the file, looking for file variables to set. One of them is the mode to use for the file (in this case outline-mode). The line can start with anything, so a comment character can be used.

The page Specifying File Variables gives more information on how to use them.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.