On Saturday 24 May 2008 04:38:42 pm Stefan Monnier wrote: > Looks pretty good. See some comments below. ... > > + ;; Work around bug in insert-file-contents, apparently ... > Could you expand on this "bug in insert-file-contents"? > Maybe we can fix it. I think the only person who can comment on this piece is the person who wrote it. I just copied it from a similar passage in the original nxml code. In my updated patch, I've removed the code that works around this alleged bug without ill effect. > > + (when (< (point) nxml-prolog-end) > > + (goto-char (point-min)) > > + (nxml-fontify-prolog) > > + (goto-char nxml-prolog-end)) > > Fontifying outside of (point)...bound is likely to lead to problems. I think this code is okay though, since nxml-extend-region *does* snap the fontification region to (point-min), and nxml is written to fontify the prolog by moving forward over the whole thing, fontifying along the way. > > + (when (not (eq nxml-last-fontify-end (point))) > > + (when (not (equal (char-after) ?\<)) > > + (search-backward "<" nxml-prolog-end t)) > > + (nxml-ensure-scan-up-to-date) > > + (nxml-move-outside-backwards)) > > This should be done in nxml-extend-region instead. OTOH, this chunk shouldn't be there. You're right. Removing this code exposed a bug, which is corrected in my updated patch. The original nxml mode also had this bug, but because nxml-mode always fontified whole lines, the bug didn't cause problems. Also, (let (xmltok-dependent-regions xmltok-errors) (while (and (< (point) bound) (nxml-tokenize-forward)) (nxml-apply-fontify-rule))) will cause problems if the last nxml token extends beyond bound. nxml-extend-region ensures that it doesn't, but can we count on it?