From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Doug Lewan Newsgroups: gmane.emacs.help Subject: RE: Automatically enable python mode Date: Thu, 18 Oct 2012 13:37:41 +0000 Message-ID: <155DEC68569B714B86C2C7075F5EDA9826952392@DAKIYA1.pegasus.local> References: <20121018143242.37910206@pcolivier.chezmoi.net> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1350567435 30025 80.91.229.3 (18 Oct 2012 13:37:15 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 18 Oct 2012 13:37:15 +0000 (UTC) To: "help-gnu-emacs@gnu.org" , "diolut@bigfoot.com" Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Oct 18 15:37:22 2012 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TOqHj-0003iI-MO for geh-help-gnu-emacs@m.gmane.org; Thu, 18 Oct 2012 15:37:15 +0200 Original-Received: from localhost ([::1]:53734 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TOqHc-0001Ed-Lc for geh-help-gnu-emacs@m.gmane.org; Thu, 18 Oct 2012 09:37:08 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:55039) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TOqHT-0001Dq-Ba for help-gnu-emacs@gnu.org; Thu, 18 Oct 2012 09:37:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TOqHL-00029w-O3 for help-gnu-emacs@gnu.org; Thu, 18 Oct 2012 09:36:59 -0400 Original-Received: from webmail.shubertorg.com ([207.246.209.200]:44632) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TOqHK-00029T-76 for help-gnu-emacs@gnu.org; Thu, 18 Oct 2012 09:36:51 -0400 Original-Received: from dakiya1.pegasus.local ([::1]) by DAKIYA1.pegasus.local ([::1]) with mapi id 14.01.0339.001; Thu, 18 Oct 2012 09:37:43 -0400 Thread-Topic: Automatically enable python mode Thread-Index: AQHNrS0qBqZASJrBMky/u84O3oXeEpe/D9ZQ In-Reply-To: <20121018143242.37910206@pcolivier.chezmoi.net> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.0.21.202] X-detected-operating-system: by eggs.gnu.org: Windows XP/2000 (RFC1323+, w+, tstamp-) X-Received-From: 207.246.209.200 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:87317 Archived-At: 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 "p= ython2" '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=3Dshubertticketing.com@gnu.org > [mailto:help-gnu-emacs-bounces+dougl=3Dshubertticketing.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 >=20 > I am using arch GNU/Linux. If a file contains: >=20 > #! /usr/bin/python >=20 > 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 >=20 > #! /usr/bin/python2 > or > #! /usr/bin/python3 >=20 > How can I tell emacs that it have to automatically enable python mode > when one of the two line is the first line? >=20 > Olive