From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Lennart Borgman Newsgroups: gmane.emacs.help Subject: Re: Making auto-mode-alist override interpreter-mode-alist Date: Wed, 22 Jul 2009 19:06:24 +0200 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1248282678 3792 80.91.229.12 (22 Jul 2009 17:11:18 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 22 Jul 2009 17:11:18 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Francis Devereux Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Jul 22 19:11:11 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MTfLR-0007HF-Um for geh-help-gnu-emacs@m.gmane.org; Wed, 22 Jul 2009 19:11:10 +0200 Original-Received: from localhost ([127.0.0.1]:56486 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MTfLR-0007Gw-A6 for geh-help-gnu-emacs@m.gmane.org; Wed, 22 Jul 2009 13:11:09 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MTfGw-000319-Vq for help-gnu-emacs@gnu.org; Wed, 22 Jul 2009 13:06:31 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MTfGs-0002x3-Bh for help-gnu-emacs@gnu.org; Wed, 22 Jul 2009 13:06:30 -0400 Original-Received: from [199.232.76.173] (port=35387 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MTfGr-0002wn-PX for help-gnu-emacs@gnu.org; Wed, 22 Jul 2009 13:06:25 -0400 Original-Received: from mail-yx0-f172.google.com ([209.85.210.172]:59979) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MTfGr-0008Av-DX for help-gnu-emacs@gnu.org; Wed, 22 Jul 2009 13:06:25 -0400 Original-Received: by yxe2 with SMTP id 2so558748yxe.14 for ; Wed, 22 Jul 2009 10:06:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=LxNB8eLsP0pQp3B0/be4oVMV6qV27x6YajWSTCOmmNQ=; b=munjSf3TjxbgDdFwMbVXXSfuOm1nQDnX9/nabzzJ5Kbo5VIkNlBB8usNtPbOb1NHUy 2l380PBKSihO4C0kCm33I30zPk7lXAvBmn6su6C4vIy8HlA1/FakdD7DizXdWbwb7YEA eceRiFuI2UuKyx3m0MOVXC5qPnJ0zLvwgv5X4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=UOa7Gn5McDjihxh/InA95SXFEb1aUYYq3u8QzCGzDgZvsD2xswOAMhTnNQmp7en4zD wIiidgQeji/0mb15h5EXJ340J6CyBd0p4dgrZ8doAdypIWkTmDGzOiighR1Hhft2VN/P gixJpF+UAovxalclnVE5/Nvpa66b4sXuwOJrQ= Original-Received: by 10.100.229.14 with SMTP id b14mr1423219anh.187.1248282384341; Wed, 22 Jul 2009 10:06:24 -0700 (PDT) In-Reply-To: X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:66339 Archived-At: On Wed, Jul 22, 2009 at 6:46 PM, Francis Devereux wrote: > Hi, > > I have derived a mode from python-mode that has some settings for my > company's Python coding style. =C2=A0I want to use this mode (bright-pyth= on-mode) > for .py files in certain directories but use the default python-mode for = all > other .py files. > > I have the following in my auto-mode-alist: > (set-variable 'auto-mode-alist > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(append '( > ... > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0("/Users/francis/Code/Bright/.*\= \.py$" . bright-python-mode) > ... > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0) auto-mode-alist)) > > This works for most files, but not for those whose first line is > #!/usr/bin/python. =C2=A0They always open in python-mode, regardless of t= he > directory that they are in. =C2=A0I think that this is happening because > interpreter-mode-alist is overriding auto-mode-alist. =C2=A0Is there any = way to > make auto-mode-alist have priority over interpreter-mode-alist? You can defadvice python-mode instead of modifying the lists. There is nothing magic about major mode functions. They are just functions that set up for editing in the buffer.