Is there any way to open an emacs file so that all local variables definitions are ignored? I often use local variables into tex documents to fix root documents, dictionaries, etc. Sometimes I need to compile some document ignoring these variables.

For example, in a TeX document, I have

%%  Local Variables: 
%%  TeX-master: t  
%%  End:

Sometimes I'd like to ignore that because, for example, I don't want to treat the file as a master file.

  • 1
    You likely wouldn't actually want to do that. I think you'd quickly find that some of the local variables are quite important, such as default-directory and all of your buffer-local minor modes. I suspect you only need to ignore some subset and that you should target that subset explicitly. Which variables do you need to ignore, and in which circumstances? Is it just for M-x compile?
    – phils
    Apr 14, 2021 at 10:12
  • I edited the question explaining what type of variables I would like to ignore Apr 15, 2021 at 7:45
  • What you mean are file variables.
    – Tobias
    Apr 15, 2021 at 13:18

1 Answer 1


The doc string of enable-local-variables says:

A value of nil means always ignore the file local variables.

You can customize the value of this variable to Ignore, open your file and revert the customization.

Then there is also the variable local-enable-local-variables which you can use itself as file variable. If you set this variable to nil all other file variables are ignored with the exception of a mode specification in a leading -*- ... -*- comment at the beginning of the file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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