开发者

How to get emacs to ignore the shebang (#!/some/interpreter) when determining what mode to open a file

开发者 https://www.devze.com 2023-02-17 18:02 出处:网络
I\'m editing python files which are intended to be executed by Jython so they the appropriate shebang at the top of the file:

I'm editing python files which are intended to be executed by Jython so they the appropriate shebang at the top of the file:

#!/usr/bin/jython

This results in the files being opened in jython-mode. Ho开发者_高级运维wever, I want to use python-mode. I can not seem to get the buffer into python-mode and out of jython-mode in anyway other than removing the shebang and reverting the buffer. Even running python-mode doesn't accomplish this (the buffer is still in jython-mode). Can I put some type of hook in place to ignore the shebang for .py files?

If it matters, I'm using emacs-22.


Add the following to your .emacs:

(delq (assoc "jython" interpreter-mode-alist) interpreter-mode-alist)

See the documentation for How Emacs Chooses a Major Mode. Or you can use the heavy hammer and get rid of shebang handling altogether:

(setq interpreter-mode-alist nil)
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号