Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Varnish: Misc

Editing XML with Emacs



Varnish misc RSS feed   Index | Next | Previous | View Threaded

des at linpro

Feb 22, 2006, 6:19 AM

Post #1 of 1 (292 views)
Editing XML with Emacs

The default editing mode for XML files in FSF Emacs is James Clark's
sgml-mode. There are many disadvantages to sgml-mode: it doesn't
really grok XML very well (it was designed for SGML), it doesn't grok
encodings, etc.

James Clark has written a new Emacs mode specifically for XML, called
nXML (nxml-mode). It is not part of the FSF Emacs distribution (yet),
but it is available in both Ubuntu and FreeBSD as nxml-mode (or
editors/nxml-emacs21 if you want to build it from ports). It has much
better syntax highlighting than sgml-mode, and proper indentation and
auto-fill support, which sgml-mode lacks completely.

Far more importantly, nxml-mode is schema-aware. This means that it
offers completion of tags, namespace URIs etc., and can detect and
visualize (normally with red underlining) errors in the document. All
this requires, of course, that nxml-mode knows the schema you are
using; it currently supports DocBook, XHTML, XSLT, RDF and a few

The only customization I have found necessary to feel comfortable with
nxml-mode is the following:

(defun des-nxml-mode-hook ()
(local-set-key "\C-m" 'newline-and-indent)
(local-set-key "\C-c\C-e" 'nxml-finish-element))
(add-hook 'nxml-mode-hook 'des-nxml-mode-hook)

I *highly* recommend nxml-mode for editing DocBook documentation for
Varnish - so much so that I'm considering making nxml-mode's default
formatting the required formatting style for DocBook.

Dag-Erling Sm?rgrav
Senior Software Developer
Linpro AS - www.linpro.no

Varnish misc RSS feed   Index | Next | Previous | View Threaded

Interested in having your list archived? Contact Gossamer Threads
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.