unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
Cc: bug-cc-mode@gnu.org, emacs-pretest-bug@gnu.org, emacs-devel@gnu.org
Subject: Re: [simon.marshall@misys.com: Font Lock on-the-fly misfontification in C++]
Date: Sun, 23 Jul 2006 15:26:30 +0100	[thread overview]
Message-ID: <20060723142630.GB1433@muc.de> (raw)
In-Reply-To: <E1G3OAq-0004WV-P1@fencepost.gnu.org>

Hi, Simon; Hi, Richard!

On Wed, Jul 19, 2006 at 10:22:00PM -0400, Richard Stallman wrote:
> Please DTRT.

> ------- Start of forwarded message -------
> From: "Marshall, Simon" <simon.marshall@misys.com>
> To: "'Emacs Pretest Bug (emacs-pretest-bug@gnu.org)'"
> 	<emacs-pretest-bug@gnu.org>
> Date: Wed, 19 Jul 2006 16:46:04 +0100
> MIME-Version: 1.0
> Content-Type: text/plain
> Subject: Font Lock on-the-fly misfontification in C++
> X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=failed 
> 	version=3.0.4

> Put the following in a fubar.cpp:

> class Fubar :
>   public Foo,	// Foo fontified as a type, at first
>   public Bar	// Bar fontified as a type, at first
> {
>   Foo bar(Snafu snafu,	// Types, function, variable fontified, at first
> 	  Foo foo,
> 	  Bar bar);
>   Foo bar(Snafu *snafu,	// Types, function, variable fontified, at first
> 	  Foo foo,
> 	  Bar bar);
> };

> Then emacs -Q fubar.cpp.  I see Foo, Bar and Snafu fontified as types
> even where declaring functions and variables.  The corresponding
> functions and variables are fontified correctly.  This is great!

> Then do the following.

> 1.  Append a space to the first (or second) commented line.  Bug:
> fontification of Foo (or Bar) is removed from that line.

> 2.  Append a space to the third commented line.  Bug: fontification of Foo
> and bar is removed from that line.

> 3.  Append a space to the fourth commented line.  Bug: fontification of Foo,
> bar, Snafu and snafu is removed from that line.

The problem is that after a textual change, the changed line gets
fontified as an atomic entity, i.e. yanked out of its context.  The
solution is to determine the bounds of the region to fontify by analysing
the surrounding text syntactically.  (Sorry about the number of big words
in that sentence.)  Such a determination would, in these cases, identify
exactly the comments on these lines.

There is a lot of work to be done here in CC Mode, and possibly some
enhancements are still needed in Font Lock.  I'm hoping to do the CC Mode
bit for release 5.32 (the current release is 5.31.3) within a year or
two.  In the meantime, a workaround is M-o M-o,
`font-lock-fontify-block'.

> Somewhat spookily, if you then repeat (2), then the fourth commented line
> (3) gets fontified correctly after the deferral delay.

Yes.  Changing the "public Bar" line marks all subsequent text for
deferred fontification.  This latter is done in the full syntactic
context.  Yes, it's disconcerting.

> I think this is some sort of problem with Jit Lock mode multiline
> fontification, at least for (2) and (3), since Lazy Lock mode works ok.

Isn't Lazy Lock obsolete in Emacs 22?

-- 
Alan Mackenzie (Munich, Germany)


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV


       reply	other threads:[~2006-07-23 14:26 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <E1G3OAq-0004WV-P1@fencepost.gnu.org>
2006-07-23 14:26 ` Alan Mackenzie [this message]
2006-07-24  3:11   ` [simon.marshall@misys.com: Font Lock on-the-fly misfontification in C++] Stefan Monnier
2006-07-24 13:33     ` Alan Mackenzie
2006-07-24 14:36       ` Stefan Monnier
2006-07-24 19:29         ` Alan Mackenzie
2006-07-24 20:43           ` Stefan Monnier
2006-07-24 22:29             ` Alan Mackenzie
2006-07-24 22:30               ` Stefan Monnier
2006-07-24 14:35   ` Stefan Monnier
2006-07-31 22:04     ` Alan Mackenzie
2006-07-31 22:03       ` Stefan Monnier
2006-08-01  9:21         ` Alan Mackenzie
2006-08-01 14:55           ` Stefan Monnier
2006-08-01 19:48             ` Alan Mackenzie
2006-08-01 19:23               ` Stefan Monnier
2006-08-03  8:45                 ` Alan Mackenzie
2006-08-03 15:12                   ` Stefan Monnier
2006-07-31 23:59       ` Richard Stallman
2006-08-01  7:59         ` Alan Mackenzie
2006-08-01  8:32           ` David Kastrup
2006-08-01 20:09           ` Richard Stallman
2006-08-01  8:06         ` Romain Francoise
2006-08-01 20:09           ` Richard Stallman
2006-08-02  9:38         ` Aidan Kehoe
2006-08-02  9:57           ` David Kastrup
2006-08-02 10:28             ` Aidan Kehoe
2006-08-02 11:57               ` David Kastrup
2006-08-02 12:52                 ` Aidan Kehoe
2006-08-02 13:21                   ` David Kastrup
2006-08-02 13:31                     ` Aidan Kehoe
2006-08-02 14:02                       ` David Kastrup
2006-08-02 13:59                 ` Stefan Monnier
2006-08-02 14:12                   ` Aidan Kehoe
2006-08-02 14:14                   ` David Kastrup
2006-08-02 21:20             ` Richard Stallman
2006-08-03  9:17               ` Alan Mackenzie
2006-08-03  8:42                 ` David Kastrup
2006-08-03  8:54                   ` Aidan Kehoe
2006-08-03 19:15                 ` Richard Stallman

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=20060723142630.GB1433@muc.de \
    --to=acm@muc.de \
    --cc=bug-cc-mode@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=emacs-pretest-bug@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).