unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Lennart Borgman (gmail)" <lennart.borgman@gmail.com>
To: emacs-nxml-mode@yahoogroups.com,
	 Daniel Colascione <dan.colascione@gmail.com>
Cc: "Eric M. Ludlam" <eric@siege-engine.com>,
	 Emacs Devel <emacs-devel@gnu.org>
Subject: Re: [patch] use font-lock
Date: Fri, 23 May 2008 23:52:49 +0200	[thread overview]
Message-ID: <48373CB1.5040302@gmail.com> (raw)
In-Reply-To: <200805231711.30830.danc@merrillpress.com>

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/



       reply	other threads:[~2008-05-23 21:52 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200805231711.30830.danc@merrillpress.com>
2008-05-23 21:52 ` Lennart Borgman (gmail) [this message]
2008-05-23 22:24   ` [emacs-nxml-mode] [patch] use font-lock Daniel Colascione
     [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)
2008-05-24  2:39   ` [emacs-nxml-mode] " Stefan Monnier
2008-05-23 22:26 Daniel Colascione
2008-05-24 20:38 ` Stefan Monnier
2008-05-25 20:36   ` Daniel Colascione
2008-05-26 14:52     ` Stefan Monnier
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

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=48373CB1.5040302@gmail.com \
    --to=lennart.borgman@gmail.com \
    --cc=dan.colascione@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=emacs-nxml-mode@yahoogroups.com \
    --cc=eric@siege-engine.com \
    /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).