XML Syntax on Emacs Posted on 2007-06-10 by Dave Fowler
My Emacs editor unfortunately doesn't know that I'm developing for Zope/Plone and that .zcml and .pt files are a form of XML. I had to look up how to let it know so I could get some syntax highlighting and smart tabbing. Without those, XML is really annoying. This time ThaiOpenSource.com had the solution with nXML. It was surprisingly easy to setup. Download the latest version of nxml-mode-YYYYMMDD.tar.gz and follow the README. As always there are some modifications to the README to suit specific needs. Here's what I did.
- Untar the nxml-mode-YYYYMMDD into ~/emacs
- Open emacs and type
* `<alt>-x load-file <ret> ` * `~/emacs/nxml-mode-YYYYMMDD/rng-auto.el <ret>` * `<alt>-x nxml-mode <ret>`
- Now to get it to load every time open your
/.emacs file and add `(load "/emacs/nxml-mode-YYYYMMDD/rng-auto.el")`
- Also add the following to get it to recognize common xml extensions including .zcml and .pt
(setq auto-mode-alist (cons '(".(xml|xsl|zcml|pt|rng|xhtml)'" . nxml-mode) auto-mode-alist))
- Restart Emacs
That should do it.