emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [patch] use font-lock


From: Daniel Colascione
Subject: Re: [patch] use font-lock
Date: Sun, 25 May 2008 16:36:26 -0400
User-agent: KMail/1.9.9

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?

Attachment: nxml-mode-2.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]