[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: about auto-mode-alist
From: |
step |
Subject: |
Re: about auto-mode-alist |
Date: |
Thu, 29 Nov 2007 18:38:01 -0800 (PST) |
User-agent: |
G2/1.0 |
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