I'm trying to achieve the effect of automatically calling M-x importmagic-mode whenever I open a python file, but I need to do this in a directory specific way, using dir-locals.el.

I have this in dir-locals.el:

((python-mode . (
                 (eval . (importmagic-mode 1))

But I still have to M-x importmagic-mode every time I open a python file. What am I missing to make this automatic? Is my syntax just wrong?

1 Answer 1


You don't need the 1.

                 (eval . (importmagic-mode))

via this answer: https://stackoverflow.com/a/63797942/1052117

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.