all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Automatically enable python mode
@ 2012-10-18 12:32 Olive
  2012-10-18 13:37 ` Doug Lewan
  0 siblings, 1 reply; 2+ messages in thread
From: Olive @ 2012-10-18 12:32 UTC (permalink / raw)
  To: help-gnu-emacs

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* RE: Automatically enable python mode
  2012-10-18 12:32 Automatically enable python mode Olive
@ 2012-10-18 13:37 ` Doug Lewan
  0 siblings, 0 replies; 2+ messages in thread
From: Doug Lewan @ 2012-10-18 13:37 UTC (permalink / raw)
  To: help-gnu-emacs@gnu.org, diolut@bigfoot.com

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: help-gnu-emacs-bounces+dougl=shubertticketing.com@gnu.org
> [mailto:help-gnu-emacs-bounces+dougl=shubertticketing.com@gnu.org] On
> Behalf Of Olive
> Sent: Thursday, 2012 October 18 08:33
> To: help-gnu-emacs@gnu.org
> 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



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-10-18 13:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-18 12:32 Automatically enable python mode Olive
2012-10-18 13:37 ` Doug Lewan

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.