Hacking on sgml-mode in Emacs

2002 September 19
by darkness

Given the ugliness of last night’s entry, I thought I would get some HTML action going today. I figured XHTML 1.0 Strict was looking nice these days along with CSS level 2. I gathered all this from some weird shit on http://www.w3.org/ , so it’s probably all wrong.

Anyway, I fire up Emacs, realize I could do some tweaking. I found a nice enough article on using sgml-mode in Emacs to edit XML, XHTML, etc. Followed most of the steps. I make my first <html> element and… what? No xmlns attribute, as required by the standard? It’s because the DTD says the attribute is fixed ( #FIXED ), so sgml-mode doesn’t think it needs to insert what is already a known value. Bzzzt.

To make a long story short, I ended up patching PSGML (which gives us sgml-mode, apparently) 1.2.5 to insert fixed attributes selectively. You can apply this patch, then use something like this in your .emacs:

(setq sgml-explicit-fixed-attribute-alist '(("html" . ("xmlns"))))

This tells my patched PSGML to insert the fixed value for the xmlns attribute of the html element explicitly. There’s a bit more documentation inside.

Comments/questions/etc. are welcomed. Please be kind, as this was basically my second foray into Elisp ever. Without further adieu, my explicit fixed attribute patch to PSGML 1.2.5.

Tomorrow maybe I’ll really get a chance to make this whole mess look better.

No Comments

Leave A Comment

Note: You can use basic XHTML in your comments. Your email address will never be published.

Subscribe to this comment feed via RSS