I'm using Emacs 26.3. How do I set-input-method to latin-alt-postfix at the top of the buffer using the -*- ... -*- local-variables method? There are only certain files that I want to do this for.

I looked in the manual and wiki, but the instructions are not clear to me.

1 Answer 1


You can use the eval pseudo-variable to evaluate arbitrary code (which is dangerous, so be careful about accepting such files from others). See the description of specifying file variables in the manual: C-h i g(emacs)Specifying file variables.

Here's an example:

-*- eval: (set-input-method 'latin-alt-postfix) -*-

This is a test á á é ö etc.

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.