From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: [patch] use font-lock Date: Mon, 26 May 2008 10:52:59 -0400 Message-ID: References: <200805231826.27371.danc@merrillpress.com> <200805251636.27007.danc@merrillpress.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1211813605 19276 80.91.229.12 (26 May 2008 14:53:25 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 26 May 2008 14:53:25 +0000 (UTC) Cc: emacs-devel@gnu.org To: Daniel Colascione Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon May 26 16:53:56 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1K0e5D-0007vS-0y for ged-emacs-devel@m.gmane.org; Mon, 26 May 2008 16:53:55 +0200 Original-Received: from localhost ([127.0.0.1]:39791 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K0e4R-00006G-Lt for ged-emacs-devel@m.gmane.org; Mon, 26 May 2008 10:53:07 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1K0e4N-00005S-Oa for emacs-devel@gnu.org; Mon, 26 May 2008 10:53:03 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1K0e4N-0008WM-6Q for emacs-devel@gnu.org; Mon, 26 May 2008 10:53:03 -0400 Original-Received: from [199.232.76.173] (port=58021 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K0e4N-0008WG-2n for emacs-devel@gnu.org; Mon, 26 May 2008 10:53:03 -0400 Original-Received: from pruche.dit.umontreal.ca ([132.204.246.22]:50765) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1K0e4M-0008PC-M6 for emacs-devel@gnu.org; Mon, 26 May 2008 10:53:02 -0400 Original-Received: from ceviche.home (x-132-204-253-222.xtpr.umontreal.ca [132.204.253.222]) by pruche.dit.umontreal.ca (8.14.1/8.14.1) with SMTP id m4QErJaN014694 for ; Mon, 26 May 2008 10:53:19 -0400 Original-Received: by ceviche.home (Postfix, from userid 20848) id E452CB408C; Mon, 26 May 2008 10:52:59 -0400 (EDT) In-Reply-To: <200805251636.27007.danc@merrillpress.com> (Daniel Colascione's message of "Sun, 25 May 2008 16:36:26 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 1 Rules triggered RV3023=0 X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 3) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:97725 Archived-At: >> 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