From: step <fxlzju@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: about auto-mode-alist
Date: Thu, 29 Nov 2007 18:38:01 -0800 (PST) [thread overview]
Message-ID: <1a72b8a8-1a18-46a8-b336-e746f33c643f@e10g2000prf.googlegroups.com> (raw)
In-Reply-To: mailman.4329.1196388926.18990.help-gnu-emacs@gnu.org
On 11月30日, 上午10时13分, Billy O'Connor <bill...@gmail.com> wrote:
> step <fxl...@gmail.com> writes:
> > hi,i use gnu emacs23 ,when i set the auto-mode-alist, it seems don't
> > work.
> > the elisp i add in the my .emacs file follow:
> > (setq auto-mode-alist
> > (append '(("\\.css\\'" . css-mode)
> > ("\\.c\\'" . c-mode)
> > ("\\.cc\\'" . c++-mode)
> > ("\\.cpp\\'" . c++-mode)
> > ("\\.cxx\\'" . c++-mode)
> > ("\\.hpp\\'" . c++-mode)
> > ("\\.e\\'" . eiffel-mode)
> > ("\\.hxx\\'" . c++-mode)
> > ("\\.h\\'" . c-mode)
> > ("\\.hh\\'" . c++-mode)
> > ("\\.idl\\'" . c++-mode)
> > ("\\.ipp\\'" . c++-mode)
> > ("\\.java\\'" . java-mode)
> > ("\\.lua\\'" . lua-mode)
> > ("\\.pl\\'" . perl-mode)
> > ("\\.pm\\'" . perl-mode)
> > ("\\.rb\\'" . ruby-mode)
> > ("\\.rbw\\'" . ruby-mode)
> > ("\\.t2t\\'" . t2t-mode)
> > ("\\.txt\\'" . text-mode)
> > ("\\.py\\'" . python-mode)
> > ("\\.tex\\'" . LaTeX-mode)
> > ("\\.\\(xml\\|xsl\\|rng\\|xhtml\\)\\'" . nxml-mode)
> > )
> > auto-mode-alist))
> > when i use the C-x C-f create a new .xml file ,it can auto load to
> > nxml-mode ,but if i open a exist .xml file ,it auto load to sgml-mode
> > which is the default mode emacs set in the file.el .
> > is there somebody konw why? thanks!
>
> Your code works for my xml files, both old and new. Could you have mode
> tags at the top of some xml files that are forcing xml mode?
>
> --
> Billy O'Connor
ok i konw why this happen,the magic-mode-alist define
i add this
(setq magic-mode-alist
(cons '("<\\?xml " . nxml-mode)
magic-mode-alist))
(fset 'xml-mode 'nxml-mode)
it can work
next prev parent reply other threads:[~2007-11-30 2:38 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-30 1:38 about auto-mode-alist step
2007-11-30 2:13 ` Billy O'Connor
[not found] ` <mailman.4329.1196388926.18990.help-gnu-emacs@gnu.org>
2007-11-30 2:25 ` step
2007-11-30 2:38 ` step [this message]
2007-11-30 2:41 ` step
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=1a72b8a8-1a18-46a8-b336-e746f33c643f@e10g2000prf.googlegroups.com \
--to=fxlzju@gmail.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.
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).