From: Stefan Monnier <monnier@IRO.UMontreal.CA>
To: Daniel Colascione <danc@merrillpress.com>
Cc: emacs-devel@gnu.org
Subject: Re: [patch] use font-lock
Date: Mon, 26 May 2008 10:52:59 -0400 [thread overview]
Message-ID: <jwv8wxxnn1j.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <200805251636.27007.danc@merrillpress.com> (Daniel Colascione's message of "Sun, 25 May 2008 16:36:26 -0400")
>> 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.
Sorry, I didn't notice it came from the original code.
>> > + (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.
I see, then please add a comment explaining it. You could also replace
the (goto-char (point-min)) by (assert (bobp)) to make sure that
nxml-extend-region did its job.
>> > + (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.
Great! I love it when I'm right!
> (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?
Presumably you can count on it. Especially since no other
region-extend-function is run after nxml-extend-region.
You could also change the code to
(let (xmltok-dependent-regions
xmltok-errors)
(while (and (nxml-tokenize-forward)
(< (point) bound))
(nxml-apply-fontify-rule)))
so that in case of an error, the result is to fontify too-little rather
than too-much. This tends to be more visible, so such a bug would
presumably be caught earlier.
Stefan
next prev parent reply other threads:[~2008-05-26 14:52 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-23 22:26 [patch] use font-lock Daniel Colascione
2008-05-24 20:38 ` Stefan Monnier
2008-05-25 20:36 ` Daniel Colascione
2008-05-26 14:52 ` Stefan Monnier [this message]
2008-05-27 15:13 ` Daniel Colascione
2008-05-27 15:37 ` Stefan Monnier
2008-05-27 15:45 ` Daniel Colascione
2008-05-27 18:37 ` Stefan Monnier
[not found] ` <jwv8wxj8pf9.fsf-monnier+emacs@gnu.org>
2008-06-05 23:07 ` Daniel Colascione
2008-06-05 23:30 ` Lennart Borgman (gmail)
2008-06-06 7:01 ` Stefan Monnier
2008-06-06 7:24 ` Lennart Borgman (gmail)
2008-06-06 7:59 ` Stefan Monnier
2008-06-06 8:09 ` Lennart Borgman (gmail)
2008-06-06 10:09 ` Jason Rumney
2008-06-06 14:23 ` Chong Yidong
2008-06-06 19:04 ` Richard M Stallman
2008-06-06 16:25 ` Michael Olson
[not found] <200805231711.30830.danc@merrillpress.com>
2008-05-23 21:52 ` Lennart Borgman (gmail)
[not found] ` <200805231824.18563.danc@merrillpress.com>
2008-05-23 22:50 ` Lennart Borgman (gmail)
2008-05-24 15:03 ` Daniel Colascione
2008-05-24 16:57 ` Lennart Borgman (gmail)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=jwv8wxxnn1j.fsf-monnier+emacs@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=danc@merrillpress.com \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).