Tag Archives: libvirt

XML editing with Emacs.

I’ve been using GNU Emacs ever since I started working with the Fedora documentation team years ago. I wouldn’t call myself a power user by any means, but it handles my modest needs very well. Other people may have different preferences, which is fine. (Holy wars to /dev/null please.)

In the intervening years some really nice tools have evolved for dealing with different kinds of XML documents. I used to use the old psgml-mode to do editing of XML documents, but nowadays things are even more elegant and functional with nxml-mode. In truth, I was probably late to switch, simply because I didn’t have time to fix that which wasn’t broken.

However, ultimately psgml fell out of favor and the switch was necessary. But I discovered an array of helpful configurations that made XML editing even easier than before. I use these tools for editing DocBook XML, but they’re equally powerful for other schemas as well. For instance, you could use nxml-mode to hand-edit libvirt domain files with good confidence on their validity.

You can probably find directions like these (or even better) in a lot of places around the web. What I found difficult about the process was discovering the why as opposed to the what to do. How does all this stuff work, anyhow? None of the pages I read did a great job at explaining that. Admittedly, some of them were parts of much larger works, but I just wanted to get something done, not read an entire book. In writing the above page, I thought to myself, How can I improve this situation for the next person?

The key to solving that problem was this fantastic post by Mel Chua (and her lightning talk at FUDCon Tempe) where she talked about baking croissants. Short summary: it’s not enough to write a recipe and expect people to follow it, if your goal is to get people baking who aren’t bakers by trade. You have to take the time to fill in all the gaps.

So the result is this page I added to the Fedora wiki: How to use Emacs for XML editing.

Thanks, Mel, for the great advice. If anyone finds something wrong with that page, why bother commenting here? Just edit the wiki page if you’re a Fedora contributor (in other words, someone with an account and completed CLA). I’ll get notified when you do and everyone can benefit from your changes.

UPDATE: I revised the page slightly to give some needed background information up front and make it even more Mel-icious. Also I slightly edited this post to eliminate some awkwardness from where I rearranged text.