help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Automatically enable python mode


From: Doug Lewan
Subject: RE: Automatically enable python mode
Date: Thu, 18 Oct 2012 13:37:41 +0000

Olive,

The variable `interpreter-mode-alist' is what you want.

This worked for me to get Python2 recognized.

        (setq interpreter-mode-alist (add-to-list 'interpreter-mode-alist (cons 
"python2" 'python-mode)))

This can be found in the emacs *info* documentation at `Choosing Modes'.

I hope this helps.

,Doug

> -----Original Message-----
> From: address@hidden
> [mailto:address@hidden On
> Behalf Of Olive
> Sent: Thursday, 2012 October 18 08:33
> To: address@hidden
> Subject: Automatically enable python mode
> 
> I am using arch GNU/Linux. If a file contains:
> 
> #! /usr/bin/python
> 
> as the first line, the python mode is automatically enabled. However,
> due to the fact that python 2 and python 3 coexists, in order that
> the correct python version is reliably involved, the first line must be
> 
> #! /usr/bin/python2
> or
> #! /usr/bin/python3
> 
> How can I tell emacs that it have to automatically enable python mode
> when one of the two line is the first line?
> 
> Olive



reply via email to

[Prev in Thread] Current Thread [Next in Thread]