Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Recognize a file with a shebang and no extension

Tags:

emacs

shebang

I know that emacs can recognize a file by the extension, a -*- mode -*- first line, and even by the shebang line, but what do I do if I want to override the shebang?

For example, a script that starts with

#!/usr/bin/env python2.7
...

won't be recognized by the shebang line alone. I also can't add in a -*-python-*- line, because then the shell tries to parse it. How do I deal with this?

like image 679
Shep Avatar asked Aug 11 '13 14:08

Shep


1 Answers

You put the -*- mode: python -*- in the second line (special exception, added specifically for the shebang thingies).

like image 200
Stefan Avatar answered Oct 11 '22 23:10

Stefan