all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Doug Lewan <dougl@shubertticketing.com>
To: "help-gnu-emacs@gnu.org" <help-gnu-emacs@gnu.org>,
	"diolut@bigfoot.com" <diolut@bigfoot.com>
Subject: RE: Automatically enable python mode
Date: Thu, 18 Oct 2012 13:37:41 +0000	[thread overview]
Message-ID: <155DEC68569B714B86C2C7075F5EDA9826952392@DAKIYA1.pegasus.local> (raw)
In-Reply-To: <20121018143242.37910206@pcolivier.chezmoi.net>

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



      reply	other threads:[~2012-10-18 13:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-18 12:32 Automatically enable python mode Olive
2012-10-18 13:37 ` Doug Lewan [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=155DEC68569B714B86C2C7075F5EDA9826952392@DAKIYA1.pegasus.local \
    --to=dougl@shubertticketing.com \
    --cc=diolut@bigfoot.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.