[Top][All Lists]

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

RE: C++ mode and c-beginning-of-current-token

From: Herbert Euler
Subject: RE: C++ mode and c-beginning-of-current-token
Date: Sat, 12 May 2007 23:30:07 +0800

I found some additional strange behaviors.  First, the error in a
buffer would only be signaled once.  If an error is already signaled,
typing again does not cause another same error get signaled, but
font-lock is broken after that.  Normally, characters are assigned
with face property as they are typed.  For example, when I type
#include in a c++-mode buffer, the whole word is assigned with
font-lock-preprocessor-face after the first letter, l, is typed (when
# is typed, face are not set).  However, in the C++ buffer in which an
error has been signaled, font-lock does not work on the erroneous
region.  The erroneous starts with the beginning of the buffer (where
the original error is signaled), and ends with a statement (defined
with `c-beginning-of-statement' and `c-end-of-statement').  For
example, suppose the first line of a buffer is as below (-!- is the
point position):

   -!-#include <iostream>
   #include <vector>

and no errors have been signaled.  Now I type C-o, the buffer content
is now

   #include <iostream>
   #include <vector>

Now I type #, an error is signaled (this is slightly different from
typing in an empty buffer, in such a case the error is signaled when
typing i, rather than #).  Now if I finish the first line as below:

   #include <iostream>-!-
   #include <iostream>
   #include <vector>

The second #include <iostream> and content follows it is still
colored, while the first one is not.  Text properties on the first
line are (c-in-sws t auto-composed t fontified t).  If other content
are typed now, for example the following:

   #include <iostream>
   main ()
   #include <iostream>
   #include <vector>

all of them are not colored; text properties of the non-colored
content but the first line are (c-is-sws t auto-composed t fontified
t), and of the first line is changed to (c-is-sws t c-in-sws t
auto-composed t fontified t).

If I invoke `font-lock-fontify-region' on non-colored region manually,
they will be fontified correctly.  Font-lock in other parts of the
buffer works, but is abnormal as usual.  And there are other strange
behaviors, but they are too complicated for me to describe, so I
intend to describe only if you need.

Hope the above information helps.  Thanks.

Guanpeng Xu

FREE pop-up blocking with the new MSN Toolbar - get it now! http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/

reply via email to

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