unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
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: Sat, 24 May 2008 16:38:42 -0400	[thread overview]
Message-ID: <jwv8wxzqwng.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <200805231826.27371.danc@merrillpress.com> (Daniel Colascione's message of "Fri, 23 May 2008 18:26:27 -0400")

> 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:

Looks pretty good.  See some comments below.

 
> +  "after-change book-keeping. returns a cons containing a
> +possibly-enlarged change region. you must still call
> +nxml-extend-region on this expanded region to obtain the full
> +extent of the area needing refontification.
> +
> +For book-keeping, call this function even when fontification is
> +disabled."
> +  ;; Work around bug in insert-file-contents, apparently
> +  (when (> end (1+ (buffer-size)))
> +    (setq start 1)
> +    (setq end (1+ (buffer-size))))

Please use (point-max) rather than (1+ (buffer-size)).
Could you expand on this "bug in insert-file-contents"?
Maybe we can fix it.

> +(defun nxml-fontify-matcher (bound)
> +  "Called as font-lock keyword matcher."
> +
> +  (unless nxml-degraded
> +    (nxml-debug-change "nxml-fontify-matcher" (point) bound)
> +
> +    (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.  
Either we should change nxml-fontify-prolog so it can be told to only
fontify some part of the prolog, or we need to extend the region
according in nxml-extend-region rather than in nxml-fontify-matcher.

> +    (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.  And it indeed seems
to be done there, so it should be removed.  If it's still needed here,
despite nxml-extend-region, then we probably have a bug somewhere (for
the same reason as above:
Fontifying outside of (point)...bound is likely to lead to problems.)


        Stefan




  reply	other threads:[~2008-05-24 20:38 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 [this message]
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
     [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=jwv8wxzqwng.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).