[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: nxml-mode autoload?
From: |
Jean Magnan de Bornier |
Subject: |
Re: nxml-mode autoload? |
Date: |
Sun, 30 Oct 2005 12:55:21 +0100 |
User-agent: |
Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux) |
Arturius mac Aidan <abysmal@waters.loch> wrote :
> These entries are in my .emacs
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> ;; autoinsert.el
> ;;http://www.linuxgazette.com/issue39/marsden.html
>
> (setq auto-mode-alist
> (append '(("\\.h$" . c++-mode)
> ("\\.cpp\\'" . c++-mode)
> ("\\.moc\\'" . c++-mode))
> auto-mode-alist))
>
> (add-hook 'find-file-hooks 'auto-insert)
> (setq-default auto-insert-query nil)
>
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> ;; www.thaiopensource.com/nxml-mode
> ;; per the ~/.emacs.d/lisp/nxml-mode-20041004/README
> (load "~/.emacs.d/lisp/nxml-mode-20041004/rng-auto.el")
> (setq auto-mode-alist
> (append '(("\\.xml\\'" . nxml-mode)
> ("\\.xsl\\'" . nxml-mode)
> ("\\.rng\\'" . nxml-mode)
> ("\\.xhtml\\'" . nxml-mode))
> auto-mode-alist))
> ;;;;;;;;;;;;;;;;;EOF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>
>
> The first auto-mode-alist entries (for c++) work as expected. the ones for
> nxml-mode do not work. I can, however, start the mode with `M-x
> nxml-mode<ret>'. Does anybody know why this is not working?
>
On emacs-wiki you can find this solution:
(fset 'xml-mode 'nxml-mode)
There was a recent discussion on the french emacs group, somebody argued
this solution was lame, and proposed the following:
(defcustom drkm-misc:magic-modes-to-delete
'(html-mode sgml-mode xml-mode)
"List of mode symbols whose entries to delete in
`magic-mode-alist'."
:type '(repeat symbol)
:group 'drkm)
(when (boundp 'magic-mode-alist)
(setq magic-mode-alist
(delete-if (lambda (cell)
(memq (cdr cell)
drkm-misc:magic-modes-to-delete))
magic-mode-alist)))
(push '("\\`<\\?xml" . nxml-mode) magic-mode-alist)
This works well, provided you load cl (before these commands) if it is not
already loaded:
(require 'cl)
I cannot explain these lines but they have to do with the
"magic-mode-alist" interfering in some way with "auto-mode-alist".
hth,
--
Jean Magnan de Bornier | Cours Victor Hugo
e-mots: jean at bornier.net | 13980 Alleins France
T 08 70 39 34 03 | P 06 09 17 35 87