Emacs has opened a py file as a shell script. What went wrong and how to change?

enter image description here

  • 1
    (describe-variable 'auto-mode-alist) probably wrong for sh-mode. check your init file. – gigiair Nov 29 '20 at 17:20
  • 1
    Failing that, what is the very first line of the file? – phils Nov 29 '20 at 23:46
  • @phils, the first line is #!/usr/bin/env python3 – Viesturs Nov 30 '20 at 15:27
  • @giglair, there is nothing about (describe-variable 'auto-mode-alist) in the emacs init file. – Viesturs Nov 30 '20 at 15:28
  • 1
    If you mean that emacs -Q (and emacs -q as well?) opens the file in python-mode but plain emacs (using your config) still opens it in sh-mode, then the problem is somewhere in your own config, and so you will need to debug your config to find out why. Recursive bisection is a good approach, commenting out half of the remaining elisp each time to narrow it down to the code which is responsible. – phils Dec 3 '20 at 21:34

Your Answer

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

Browse other questions tagged or ask your own question.