From: Francis Devereux <francis@devrx.org>
To: help-gnu-emacs@gnu.org
Subject: Making auto-mode-alist override interpreter-mode-alist
Date: Wed, 22 Jul 2009 17:46:35 +0100 [thread overview]
Message-ID: <D0B5BD8C-52B3-4E88-A80D-EB7BC885BAA2@devrx.org> (raw)
Hi,
I have derived a mode from python-mode that has some settings for my
company's Python coding style. I want to use this mode (bright-python-
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
(append '(
...
("/Users/francis/Code/Bright/.*\\.py$" . bright-python-
mode)
...
) auto-mode-alist))
This works for most files, but not for those whose first line is #!/
usr/bin/python. They always open in python-mode, regardless of the
directory that they are in. I think that this is happening because
interpreter-mode-alist is overriding auto-mode-alist. Is there any
way to make auto-mode-alist have priority over interpreter-mode-alist?
I don't really want to remove the python entry from interpreter-mode-
alist because then Python scripts with a shebang whose names don't end
in .py wouldn't open in python-mode.
Thanks,
Francis
next reply other threads:[~2009-07-22 16:46 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-22 16:46 Francis Devereux [this message]
2009-07-22 17:06 ` Making auto-mode-alist override interpreter-mode-alist Lennart Borgman
2009-07-23 9:36 ` Francis Devereux
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=D0B5BD8C-52B3-4E88-A80D-EB7BC885BAA2@devrx.org \
--to=francis@devrx.org \
--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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).