From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Lennart Borgman (gmail)" Newsgroups: gmane.emacs.nxml.general,gmane.emacs.devel Subject: Re: [patch] use font-lock Date: Fri, 23 May 2008 23:52:49 +0200 Message-ID: <48373CB1.5040302@gmail.com> References: <200805231711.30830.danc@merrillpress.com> Reply-To: emacs-nxml-mode@yahoogroups.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1211579596 31471 80.91.229.12 (23 May 2008 21:53:16 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 23 May 2008 21:53:16 +0000 (UTC) Cc: "Eric M. Ludlam" , Emacs Devel To: emacs-nxml-mode@yahoogroups.com, Daniel Colascione Original-X-From: sentto-10952198-1821-1211579580-geng-emacs-nxml-mode=m.gmane.org@returns.groups.yahoo.com Fri May 23 23:53:53 2008 Return-path: Envelope-to: geng-emacs-nxml-mode@m.gmane.org Original-Received: from n20b.bullet.mail.re1.yahoo.com ([69.147.103.231]) by lo.gmane.org with smtp (Exim 4.50) id 1JzfCu-0000gP-GZ for geng-emacs-nxml-mode@m.gmane.org; Fri, 23 May 2008 23:53:48 +0200 Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=lima; d=yahoogroups.com; b=BrXP72MblRNKOZxNsgaqexmp/+I0ZDU3RNbuBo9NHXx+QfiGxVPqJWFPblCQrGnAk+nG0btE38Cw+YFZfa/lQtyrBn1fuesQfdsYtD/QhTu/7l5LLKb/hchw1EwjmgQ0; Original-Received: from [68.142.237.89] by n20.bullet.mail.re1.yahoo.com with NNFMP; 23 May 2008 21:53:01 -0000 Original-Received: from [66.218.69.1] by t5.bullet.re3.yahoo.com with NNFMP; 23 May 2008 21:53:01 -0000 Original-Received: from [66.218.67.93] by t1.bullet.scd.yahoo.com with NNFMP; 23 May 2008 21:53:01 -0000 X-Yahoo-Newman-Id: 10952198-m1821 X-Sender: lennart.borgman@gmail.com X-Apparently-To: emacs-nxml-mode@yahoogroups.com X-Received: (qmail 97786 invoked from network); 23 May 2008 21:52:59 -0000 X-Received: from unknown (66.218.67.95) by m36.grp.scd.yahoo.com with QMQP; 23 May 2008 21:52:59 -0000 X-Received: from unknown (HELO ch-smtp02.sth.basefarm.net) (80.76.149.213) by mta16.grp.scd.yahoo.com with SMTP; 23 May 2008 21:52:59 -0000 X-Received: from c83-254-150-27.bredband.comhem.se ([83.254.150.27]:62725 helo=[127.0.0.1]) by ch-smtp02.sth.basefarm.net with esmtp (Exim 4.68) (envelope-from ) id 1JzfC6-0003ht-6f; Fri, 23 May 2008 23:52:58 +0200 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.9) Gecko/20071031 Thunderbird/2.0.0.9 Mnenhy/0.7.5.666 In-Reply-To: <200805231711.30830.danc@merrillpress.com> X-Antivirus: avast! (VPS 080523-0, 2008-05-23), Outbound message X-Antivirus-Status: Clean X-Scan-Result: No virus found in message 1JzfC6-0003ht-6f. X-Scan-Signature: ch-smtp02.sth.basefarm.net 1JzfC6-0003ht-6f d04c53493ec6b6bf89b6326ba9e1199b X-Originating-IP: 80.76.149.213 X-eGroups-Msg-Info: 1:12:0:0:0 X-Yahoo-Profile: nlborgman 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:1708 gmane.emacs.devel:97620 Archived-At: Daniel Colascione wrote: > > > I've converted nxml to font-lock. I used the existing fontification > machinery > and put it inside a cc-mode-style matcher. Efficiency and output are the > same, but: > > 1) hi-lock-mode works now > 2) all conventional font-locking functions work as expected. For > example, you > can turn fontification on and off with M-x font-lock-mode. > 3) font-lock-add-keywords DTRT > 4) multiple-major-modes modes should be able to use nXML fontification now, > though this remains untested Hi Daniel, This sounds very interesting. As you might know in nXhtml I am using nxml-mode with mumamo (which is a framework for multiple major modes in a buffer). It works good even though mumamo requires that major modes uses font-lock. You might wonder how that can be the case. To make it work I implemented a workaround where I use the parsing capabilities from nxml-mode to check that the files follows the DTD specified syntax, but syntax highlighting from another mode (xml-mode/html-mode) that supports font-lock. There is one very disturbing thing with my solution: I can't stop nxml-mode from parsing the whole buffer. It parses also those parts where mumamo has assigned another major mode. (I hoped that someone some day might have the time and skill to look into this, but I did not have them.) Does you solution handle this problem? If it does, then how does it handle it? Does font-lock-fontify-region-function handle also the parsing of the xml code? That would be great, but it seems difficult. Another thing that would be great would be integration with CEDET. As you have probably seen nxml-mode is a part of CVS Emacs and CEDET will hopefully soon be. Eric Ludlam has done very much work on CEDET recently. If the completion offered by nxml-mode could be used together with CEDET that would be very good. (nXhtml currently offer this in a visible way separately, but I believe the long term solution is to go with CEDET - at least as an option.) BTW, there is a problem with hi-lock. It uses text properties which may be hidden by overlays. IMO it should use overlays with high priorities. (That seems to be the easiest solution.) > I've also added a new function: > nxml-debug-region: Interactive function. Activate the region and call > nxml-debug-region. The new region is what nxml thinks should be > re-fontified > if the original region is changed. > > The new code probably works only on Emacs 22. Lightly tested, but it > seems to > handle corner highlighting cases fine. I removed a bunch of code that > was "for redisplay", since I'm assuming font-lock handles those funky bits. > > In addition to the patch, I've attached a set of files that demonstrates > extending nXML mode to work with the Genshi template engine. The examples > ought to work with some slight modification of the embedded paths. Genshi was new to me. I will add it to mumamo.el. How did you do the integration with xhtml? > (Does the Relax NG compact syntax offer a way to say "include the next file > for this document type"?) ------------------------------------ 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/