Loading ...
Sorry, an error occurred while loading the content.
 

disabling xml-mode autoload in emacs (in favor of nxml-mode)

Expand Messages
  • Aaron Falk
    Hi- I m new at nxml and am working on getting it to automatically load when I open an XML file with emacs (21.3.50.2 powerpc-apple-darwin7.0.0). Right now I ve
    Message 1 of 3 , Jul 1, 2004
      Hi-

      I'm new at nxml and am working on getting it to automatically load when
      I open an XML file with emacs (21.3.50.2 powerpc-apple-darwin7.0.0).
      Right now I've put some magic in my .emacs which should autoload nxml
      (see below) but emacs overrides it when I open an XML file and goes
      into XML/SGML mode. I've looked at the SGML configuration options and
      can't see where to disable this. Of course, I can manually launch nxml
      by M-x nxml-mode but I'd like it to 'just work.'

      Any hints?

      Thanks,

      --aaron

      ============================

      nak:~ falk$ cat .emacs
      (custom-set-variables
      ;; custom-set-variables was added by Custom.
      ;; If you edit it by hand, you could mess it up, so be careful.
      ;; Your init file should contain only one such instance.
      ;; If there is more than one, they won't work right.
      '(ispell-program-name "/sw/bin/ispell")
      '(rng-schema-locating-files (quote ("schemas.xml"
      "/Users/falk/.schemas.xml"))))
      ;;;
      (custom-set-faces
      ;; custom-set-faces was added by Custom.
      ;; If you edit it by hand, you could mess it up, so be careful.
      ;; Your init file should contain only one such instance.
      ;; If there is more than one, they won't work right.
      '(default ((t (:stipple nil :background "white" :foreground "black"
      :inverse-video nil :box nil :strike-through nil :overline nil
      :underline nil :slant normal :weight normal :height 100 :width normal
      :family "apple-monaco")))))
      (require 'notes-variables)

      ;;; enable URL recognition in notes-mode
      (setq notes-w3-alternate-url 'browse-url)

      ;;; enable auto-fill in notes-mode
      ;;;(setq max-specpdl-size 32000)
      ;;;(setq max-lisp-eval-depth 32000)
      ;;;(require 'fa-extras)
      ;;;(add-hook 'notes-mode-hooks 'turn-on-filladapt-mode)

      (when (eq system-type 'darwin)
      (setq ispell-program-name "/sw/bin/ispell")
      (set-frame-font "fontset-mac")
      (set-keyboard-coding-system 'mac-roman-unix)
      ;;; (set-frame-font
      "-etl-fixed-medium-r-normal--14-140-75-75-m-140-iso8859-1")
      (modify-frame-parameters (selected-frame) '((font .
      "-*-Monaco-*-140-*"))))

      ;;; load necessary files to enable nXML major mode
      (load "/usr/share/nxml/rng-auto.el")
      (set-variable 'nxml-slash-auto-complete-flag t)
      (setq auto-mode-alist
      (cons '("\\.\\(xml\\|xsl\\|rng\\|xhtml\\)\\'" . nxml-mode)
      auto-mode-alist))
    • Mike Williams
      ... Add this to your ~/.emacs: (aput auto-mode-alist .xml nxml-mode) -- cheers, MikeW
      Message 2 of 3 , Jul 1, 2004
        Aaron Falk wrote:

        >I'm new at nxml and am working on getting it to automatically load ...
        >

        Add this to your ~/.emacs:

        (aput 'auto-mode-alist "\\.xml\\'" 'nxml-mode)

        --
        cheers, MikeW
      • Vincent Lefevre
        ... And what about the XML files that do not have the .xml extension? (This could be rss, html, and so on.) I prefer the following code (I don t remember where
        Message 3 of 3 , Jul 2, 2004
          On 2004-07-02 13:58:23 +1000, Mike Williams wrote:
          > Aaron Falk wrote:
          > >I'm new at nxml and am working on getting it to automatically load ...
          >
          > Add this to your ~/.emacs:
          >
          > (aput 'auto-mode-alist "\\.xml\\'" 'nxml-mode)

          And what about the XML files that do not have the .xml extension?
          (This could be rss, html, and so on.)

          I prefer the following code (I don't remember where I got it from...):

          ;; Hook to enter XML mode
          (add-hook 'hack-local-variables-hook
          (lambda ()
          (save-excursion
          (when (search-forward-regexp "^<\\?xml" 6 0)
          (nxml-mode)
          ))))

          You need an XML prolog, though.

          --
          Vincent Lefèvre <vincent@...> - Web: <http://www.vinc17.org/>
          100% validated (X)HTML - Acorn / RISC OS / ARM, free software, YP17,
          Championnat International des Jeux Mathématiques et Logiques, etc.
          Work: CR INRIA - computer arithmetic / SPACES project at LORIA
        Your message has been successfully submitted and would be delivered to recipients shortly.