darkness

Thursday, 19 September 2002

PSGML patch bugfix

darkness @ 14:16:52

Just bugfixed the PSGML explicit fixed attribute patch. Attribute edit mode didn’t insert fixed attributes properly. I think I should also take this time to mention that I haven’t tested this patch very much, so it quite likely breaks down pretty easily. Furthermore, if this screw up your computer, files, data, marriage, or thread in space-time I’m totally not responsible. (Just ask anyone.) Further furthermore, this is not at all an official patch, since I’m sure the people that wrote PSGML could do a better job at this than me; if there are any problems, please report them to me, not to the PSGML folks.

Hacking on sgml-mode in Emacs

darkness @ 04:38:59

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.

Powered by WordPress