From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Daniel Colascione Newsgroups: gmane.emacs.nxml.general,gmane.emacs.devel Subject: Re: [patch] use font-lock Date: Sat, 24 May 2008 11:03:54 -0400 Organization: Merrill Press Message-ID: <200805241103.56336.danc@merrillpress.com> References: <200805231711.30830.danc@merrillpress.com> <200805231824.18563.danc@merrillpress.com> <48374A2B.1030304@gmail.com> Reply-To: emacs-nxml-mode@yahoogroups.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1211641937 12113 80.91.229.12 (24 May 2008 15:12:17 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 24 May 2008 15:12:17 +0000 (UTC) Cc: Daniel Colascione , "Eric M. Ludlam" , Emacs Devel To: emacs-nxml-mode@yahoogroups.com Original-X-From: sentto-10952198-1825-1211641926-geng-emacs-nxml-mode=m.gmane.org@returns.groups.yahoo.com Sat May 24 17:12:57 2008 Return-path: Envelope-to: geng-emacs-nxml-mode@m.gmane.org Original-Received: from n39c.bullet.mail.sp1.yahoo.com ([66.163.168.173]) by lo.gmane.org with smtp (Exim 4.50) id 1JzvQU-0006oE-7n for geng-emacs-nxml-mode@m.gmane.org; Sat, 24 May 2008 17:12:54 +0200 Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=lima; d=yahoogroups.com; b=AdZ7iYpJQlZ1csoa7YkMch8uV6yI1GrSb5oBzWPd2+Ot9a03rtBl0Ck3KqvoxQ7i76E+rhMz0ux9xm/4RQn72isVexJNkZyhs24CvjqeJy3a38NvcPTc0zrQn/czRxq4; Original-Received: from [216.252.122.216] by n39.bullet.mail.sp1.yahoo.com with NNFMP; 24 May 2008 15:12:06 -0000 Original-Received: from [209.73.164.86] by t1.bullet.sp1.yahoo.com with NNFMP; 24 May 2008 15:12:06 -0000 Original-Received: from [66.218.67.85] by t8.bullet.scd.yahoo.com with NNFMP; 24 May 2008 15:12:06 -0000 X-Yahoo-Newman-Id: 10952198-m1825 X-Sender: danc@merrillpress.com X-Apparently-To: emacs-nxml-mode@yahoogroups.com X-Received: (qmail 64491 invoked from network); 24 May 2008 15:12:03 -0000 X-Received: from unknown (66.218.67.94) by m49.grp.scd.yahoo.com with QMQP; 24 May 2008 15:12:03 -0000 X-Received: from unknown (HELO vpn.merrillpress.com) (64.61.107.78) by mta15.grp.scd.yahoo.com with SMTP; 24 May 2008 15:12:03 -0000 X-Received: from cpe-76-180-38-217.buffalo.res.rr.com ([76.180.38.217] helo=[192.168.1.50]) by mars.merrillpress.net with esmtpsa (TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1JzvPd-000083-Mv; Sat, 24 May 2008 11:12:01 -0400 User-Agent: KMail/1.9.9 In-Reply-To: <48374A2B.1030304@gmail.com> X-Originating-IP: 64.61.107.78 X-eGroups-Msg-Info: 2:3:4:0:0 X-Yahoo-Profile: dancolascione Original-Sender: emacs-nxml-mode@yahoogroups.com Mailing-List: list emacs-nxml-mode@yahoogroups.com; contact emacs-nxml-mode-owner@yahoogroups.com List-Id: Precedence: bulk List-Unsubscribe: X-Yahoo-Newman-Property: groups-email-tradt-u Xref: news.gmane.org gmane.emacs.nxml.general:1713 gmane.emacs.devel:97647 Archived-At: On Friday 23 May 2008 06:50:19 pm Lennart Borgman (gmail) wrote: > Do you mean font-lock-fontify-region-function? Sort of. I'm talking about using a function as a matcher keyword in font-lock-keywords. This function always returns nil, but while searching, sets the face property itself between (point) and its one parameter. The advantage of using the function-matcher approach is that it interacts nicely with other users of font-lock-keywords. cc-mode has used it forever, and it seems to work well. AFAICS, this trick is undocumented. > Mumamo defines its own font-lock-fontify-region-function that does the > job. In this function it narrows the buffer to chunks where each chunk > has its own major mode. > > So the main question is: does the parsing happens in the > font-lock-fontify-region-function that you have defined in nxml-mode? (I > guess you have defined such a function?) Yes, in that the after-change function that updates bookkeeping information is called from the font-lock machinery (via font-lock-extend-after-change-function). But it doesn't matter here, because at least nxml still keeps some buffer-global information, like the end of the XML prolog (which is assume to extend from the start of the buffer to nxml-prolog-end). > One thing I think need to be taken care of is nxml-mode starting state > in chunks handled by mumamo. Is there a way to do that? I don't see an easy way to do that. The problem is that nxml needs to widen the buffer to see whether the prolog has changed, whether it's scanned as far as a given change, and so on. And then it assumes the buffer is contiguous. But I didn't write it; there may be a way to deal with the problem. I'm just speculating here, but what if there were some indirect overlay property? It would have the behavior of using, as the overlay content, the contents of another buffer. Moving the point in the parent would move the point in the child. The child buffer would have its own font-lock setup, and the resulting highlighting would show up in the parent. Using a system like that, you could stitch together multiple child buffers to form a parent that looked like it had multiple major modes. And each major mode of a child buffer wouldn't know or care about the parent. > > IMHO, font-lock itself should use overlays. > > That would probably be a performance problem. And a compatibility nightmare, you're right. But I think it would have been a better conceptual model. ------------------------------------ Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/emacs-nxml-mode/ <*> Your email settings: Individual Email | Traditional <*> To change settings online go to: http://groups.yahoo.com/group/emacs-nxml-mode/join (Yahoo! ID required) <*> To change settings via email: mailto:emacs-nxml-mode-digest@yahoogroups.com mailto:emacs-nxml-mode-fullfeatured@yahoogroups.com <*> To unsubscribe from this group, send an email to: emacs-nxml-mode-unsubscribe@yahoogroups.com <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/