unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Jiajian Huang <wherejoystarts@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 24271@debbugs.gnu.org
Subject: bug#24271: 25.1; font-lock problem of c++-mode
Date: Sat, 20 Aug 2016 15:57:02 +0800	[thread overview]
Message-ID: <02148DC1-20D2-41B8-BA43-CFBE6A07C3F6@gmail.com> (raw)
In-Reply-To: <1645ABE9-D61A-4DDE-B4D6-94A29A2CC2AA@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2824 bytes --]

(I’m sorry for resending this message.)

Hi, Thanks for your reply. 

I’m not meaning to write invalid C++ program intentionally, like making a “int test” into “in test”.

When we’re typing “int test”, we type the “i” first then “n”, then “t”, then “ “(space), then “test”, namely,

“i” -> “in” -> “int” -> “int “ -> … -> “int test”,

even “normally” typing, the syntax keeping changing. Let’s keep tracking this procedure.



As you can see, none of the above images shows a “valid” C++ program. But the color(or the font style) has at least
changed twice. Base on what you’ve point out, the color should change once the “i” is input  and keep unbold till image 4 
since none of them is valid.

This could happen in any other place when typing in c++-mode, like

Example 1


Why the “vector” in the first image and third is not turn into “bold red” ?
Why the “vec” in the second image is turn into “bold red” ?

Example 2


This is a more serious example. As you can see, I normally input such a short line “using std::string”, the color have change 6 times !
I don’s think any of them is a “valid” C++ program except the last one.

I’ve not seen any other major mode has such a “feature”. This is my first time get into c++-mode. Because of this mechanism,
the current input area keep “flashing” too much when keep typing fast within a buffer full of words even under such a light color theme. 
I feel that it’s so different from other major mode(python-mode etc.) soon as I switch to c++-mode. Maybe it’s not a bug, but I don’t think it’s a good feature.

Thanks.

> On 20 Aug 2016, at 14:56, Eli Zaretskii <eliz@gnu.org <mailto:eliz@gnu.org>> wrote:
> 
>> From: Jiajian Huang <wherejoystarts@gmail.com <mailto:wherejoystarts@gmail.com>>
>> Date: Sat, 20 Aug 2016 08:42:43 +0800
>> 
>> I recently notice that there's some strange behaviours of the font-lock of the c++-mode.
> 
> I don't see it as strange.
> 
>> Let's start emacs by `emacs -Q` in the terminal, edit a new file `test.cpp` and save the following contents
>> 
>> Then put the cursor two lines above the `int main` line, type `int test`, you will find that the color of word `main` changes from *blue* to *black*
>> 
>> Backspace the current line to `in` or `i`, you will see that the color of `main` change back to *blue*
> 
> When you insert "int test", without the semi-colon, your buffer now
> has an invalid C++ program, so it's a small wonder the colors change.
> When you replace "int test" with "in test", the "in" part is no longer
> a C++ type, so it's again small wonder that colors change.
> 
>> Is this a emacs bug ?
> 
> I don't think it's a bug.
> 
> Thanks.

[-- Attachment #2.1: Type: text/html, Size: 7623 bytes --]

[-- Attachment #2.2: Screen Shot 2016-08-20 at 15.06.25.png --]
[-- Type: image/png, Size: 20585 bytes --]

[-- Attachment #2.3: Screen Shot 2016-08-20 at 15.06.35.png --]
[-- Type: image/png, Size: 20927 bytes --]

[-- Attachment #2.4: Screen Shot 2016-08-20 at 15.06.42.png --]
[-- Type: image/png, Size: 21047 bytes --]

[-- Attachment #2.5: Screen Shot 2016-08-20 at 15.06.53.png --]
[-- Type: image/png, Size: 24360 bytes --]

[-- Attachment #2.6: Screen Shot 2016-08-20 at 15.16.20.png --]
[-- Type: image/png, Size: 26539 bytes --]

[-- Attachment #2.7: Screen Shot 2016-08-20 at 15.17.10.png --]
[-- Type: image/png, Size: 30376 bytes --]

[-- Attachment #2.8: Screen Shot 2016-08-20 at 15.17.18.png --]
[-- Type: image/png, Size: 33241 bytes --]

[-- Attachment #2.9: Screen Shot 2016-08-20 at 15.17.27.png --]
[-- Type: image/png, Size: 33963 bytes --]

[-- Attachment #2.10: Screen Shot 2016-08-20 at 15.34.47.png --]
[-- Type: image/png, Size: 25604 bytes --]

[-- Attachment #2.11: Screen Shot 2016-08-20 at 15.27.05.png --]
[-- Type: image/png, Size: 26325 bytes --]

[-- Attachment #2.12: Screen Shot 2016-08-20 at 15.27.56.png --]
[-- Type: image/png, Size: 25547 bytes --]

[-- Attachment #2.13: Screen Shot 2016-08-20 at 15.28.03.png --]
[-- Type: image/png, Size: 26826 bytes --]

[-- Attachment #2.14: Screen Shot 2016-08-20 at 15.28.10.png --]
[-- Type: image/png, Size: 26929 bytes --]

[-- Attachment #2.15: Screen Shot 2016-08-20 at 15.28.32.png --]
[-- Type: image/png, Size: 28488 bytes --]

[-- Attachment #2.16: Screen Shot 2016-08-20 at 15.28.40.png --]
[-- Type: image/png, Size: 30505 bytes --]

[-- Attachment #2.17: Screen Shot 2016-08-20 at 15.28.43.png --]
[-- Type: image/png, Size: 29572 bytes --]

  parent reply	other threads:[~2016-08-20  7:57 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-20  0:42 bug#24271: 25.1; font-lock problem of c++-mode Jiajian Huang
2016-08-20  6:56 ` Eli Zaretskii
     [not found]   ` <1645ABE9-D61A-4DDE-B4D6-94A29A2CC2AA@gmail.com>
2016-08-20  7:52     ` Eli Zaretskii
2016-08-20  7:57     ` Jiajian Huang [this message]
2016-08-20  8:15       ` Eli Zaretskii
2016-08-20  8:27         ` Jiajian Huang
2016-08-20  8:36           ` Eli Zaretskii
2019-11-17  7:08       ` Lars Ingebrigtsen

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=02148DC1-20D2-41B8-BA43-CFBE6A07C3F6@gmail.com \
    --to=wherejoystarts@gmail.com \
    --cc=24271@debbugs.gnu.org \
    --cc=eliz@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).