|
From: Alan M. <ac...@mu...> - 2017-05-01 09:51:43
|
Hello, Ludwig.
On Sat, Apr 15, 2017 at 09:39:40 +0100, Lud wrote:
> Hello Allan,
> Thank you for your patch.
> > Please apply the patch below. I think it works on the test code in your
> > original bug report, but would you please try it out on your normal code,
> > and either let me know that it works, or tell me what still needs fixing.
> > This patch attempts to remove the "ambiguity" of font locking which
> > happened with deleting and reinserting the ">", and such like.
> On my code, the result is better, but I still have some not consistent
> behaviors. I tested with the below snippet of code, and the master
> branch the git repo of emacs:
> 1 #include <vector>
> 3 struct NotHighlighted{ int a; };
> 5 namespace abc { struct NotHighlighted2{ int b; }; }
> 7 // $ g++ test.cpp # should compile correctly
> 8 int main () {
> 9 std::vector<NotHighlighted> foo;
> 10 std::vector<abc::NotHighlighted2> bar;
> 11 }
> After my tests, here are my results:
> 1. Open the file with the snippet, types in both vector are not
> higlighted. I expected to be higlighted?
What is happening with "NotHighlighted" is this: the identifier is
scanned on line 3 and entered into CC Mode's "found types" list. (This
records identifiers whose context shows they must be types). Then
"NotHighlighted2" is scanned on L5, and entered into the list. But in
doing so, "NotHighlighted" gets removed, as it consists of all but the
last character of the new identifier. The thinking here is that a new
identifier is going to be typed in one character at a time, and that the
list should not be clogged up by all the "partial identifiers".
You can verify this by replacing "NotHighlighted2" by "NotHighlighted22".
This identifier then gets fontified at mode start.
I'm not sure how to solve this.
I'm still working on the other problems. I'll get back to you later.
> 2. Remove and put back '>' of 'std::vector<NotHighlighted> foo' makes
> the higlight on for the type.
> 3. Add a '2' at the end of the type 'std::vector<NotHighlighted> foo',
> highlight is still on. I expected to be off?
> 4. Replace the '2' by a '3' for 'std::vector<NotHighlighted> foo',
> highlight of the type is off. Looks good to me.
> 5. Remove and put back '>' of 'std::vector<abc::NotHighlighted> bar',
> the highlight of the type is still off. I expect to be on with namespaces?
> Let me know your thoughts about these points.
> King regards
> Ludwig
--
Alan Mackenzie (Nuremberg, Germany).
|