help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Interfering fontification in C?


From: Alan Mackenzie
Subject: Re: Interfering fontification in C?
Date: Wed, 31 Dec 2003 11:51:32 +0000
User-agent: tin/1.4.5-20010409 ("One More Nightmare") (UNIX) (Linux/2.0.35 (i686))

Douglas "Local Deity" Lewan <doug@toucan.emperorlinux.com> wrote on Wed,
31 Dec 2003 05:19:09 GMT:

> All,

> On occasion, C-mode gets into a bad fontification state for me.

What Emacs version are you using?  (M-x emacs-version).
What CC Mode version have you got?  (M-x c-version).

> With every keystroke, I'll get an error like the following.

>   font-lock-fontify-keywords-region(162 687 nil)
>   font-lock-default-fontify-region(162 663 nil)
>   font-lock-fontify-region(162 663)
>   run-hook-with-args(font-lock-fontify-region 162 663)
>   jit-lock-fontify-now(162 662)
>   jit-lock-function(162)
>   sit-for(0.125)
>   jit-lock-stealth-fontify()
>   apply(jit-lock-stealth-fontify nil)
>   byte-code("...." [timer apply 5 6] 4)
>   timer-event-handler([t 0 3 0 3 jit-lock-stealth-fontify nil t])

OK.  This is the back trace.  What was the error message that was
signalled?  (This message should appear in your *Messages* buffer.)

> There are also errors that claim emacs has tried something like

>   (font-lock-fontify-region (match-beginning 5)
>                             (match-end 1))

> which seems pretty darned odd to me.  (Sorry if I've got the real error
> here wrong.  It happens inside an (eval) and I'm not seeing it at the
> moment.)

Not necessarily.  In this case, match 1 probably _encloses_ matches 2, 3,
4 and 5.

> Can anyone one help me understand what's going on?  Or fix it?
> Or avoid it?

Yes, maybe, and hopefully yes.  My feel is that you've hit some nasty
interaction between CC Mode and Jit Lock mode.  The backtrace you give
above shows that the error is happening during Jit Lock's "stealth
fontification" (i.e., the background fontification which happens after
you haven't typed a key for some time.)

One way forward could be to upgrade to the latest CC Mode (available from
<http://cc-mode.sourceforge.net/release.php>).  This might help if your
current version (M-x c-version) is lower than 5.31.  If you're already
using 5.31 (or 5.31.1, etc.) and are prepared to help debug the problem,
a bug report to the CC Mode mailing list (at bug-cc-mode@gnu.org) would
be most appreciated.

As a quick fix, you might try using Lazy Lock mode instead, by putting
the following early on in your .emacs:

(setq font-lock-support-mode 'lazy-lock-mode) 

Happy New Year!

> Douglas Lewan

-- 
Alan Mackenzie (Munich, Germany)
Email: aacm@muuc.dee; to decode, wherever there is a repeated letter
(like "aa"), remove half of them (leaving, say, "a").



reply via email to

[Prev in Thread] Current Thread [Next in Thread]