From: Alan Mackenzie <acm@muc.de>
To: Oleh Krehel <oleh@oremacs.com>
Cc: emacs-devel@gnu.org
Subject: Re: CC-mode highlight change between 24.5 and 25
Date: Tue, 6 Sep 2016 17:02:17 +0000 [thread overview]
Message-ID: <20160906170217.GA6388@acm.fritz.box> (raw)
In-Reply-To: <874m5tp2rw.fsf@oremacs.com>
Hello, Oleh.
On Tue, Sep 06, 2016 at 03:37:55PM +0200, Oleh Krehel wrote:
> Hi Alan,
> Alan Mackenzie <acm@muc.de> writes:
[ .... ]
> > So, please try out the following, and let me know, again, how it copes
> > with real C++ code. Thanks!
> I'm testing the updated code. Looks much better. But I attach an example
> where it still highlights a variable as a function. It's a strange
> example as well: the comments and previous statements are significant. I
> reduced the code to around 10 lines and it's not easy to reduce further.
Thanks for taking the trouble to reduce it. It really does help!
> Here's how I test it:
> emacs -Q cctest.cc
> The variable `gfs' is highlighted as a function. The highlight is quite
> volatile: adding a newline before the line removes the highlight.
I've tracked the cause of this down. The line with "gfs" is at the
start of a (500 byte) jit-lock fontification hunk. So CC Mode checks
whether the first form in the hunk is really a sub-form of what just
came before.
It then calls a critical function `c-font-lock-declarators', but
_without_ the &optional new argument `not-top' which should be t to
signify "not at the top level". So this identifier gets fontified as
though it were at the top level, i.e. as a function.
Note that if you fontify the line with M-o M-o, for example, the above
scenario doesn't occur, and the id gets font-lock-variable-name-face.
There are quite a few calls to `c-font-lock-declarators', and I'm going
to have to attend to each one of them individually. So, give me a
little time, and then I'll send you patch version 3.
> Oleh
--
Alan Mackenzie (Nuremberg, Germany).
next prev parent reply other threads:[~2016-09-06 17:02 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-02 11:58 CC-mode highlight change between 24.5 and 25 Oleh Krehel
2016-09-02 13:27 ` Alan Mackenzie
2016-09-02 14:10 ` Yuri Khan
2016-09-02 14:40 ` Alan Mackenzie
2016-09-02 17:39 ` Davis Herring
2016-09-02 17:48 ` Eli Zaretskii
2016-09-04 22:29 ` Alan Mackenzie
2016-09-02 14:18 ` Oleh Krehel
2016-09-02 14:31 ` Alan Mackenzie
2016-09-02 17:21 ` Davis Herring
2016-09-04 15:38 ` Alan Mackenzie
2016-09-05 9:27 ` Oleh Krehel
2016-09-05 15:20 ` Alan Mackenzie
2016-09-06 13:37 ` Oleh Krehel
2016-09-06 17:02 ` Alan Mackenzie [this message]
2016-09-07 14:10 ` Alan Mackenzie
2016-09-09 10:01 ` Oleh Krehel
2016-09-11 21:22 ` Alan Mackenzie
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160906170217.GA6388@acm.fritz.box \
--to=acm@muc.de \
--cc=emacs-devel@gnu.org \
--cc=oleh@oremacs.com \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.