From: Daniel Colascione <dancol@dancol.org>
To: "Óscar Fuentes" <ofv@wanadoo.es>, emacs-devel@gnu.org
Subject: Re: [PATCH] support a few of the new features of C++11 in syntax highlighting
Date: Tue, 18 Nov 2014 10:11:57 -0800 [thread overview]
Message-ID: <546B8BED.9050208@dancol.org> (raw)
In-Reply-To: <87zjbo4cc7.fsf@wanadoo.es>
[-- Attachment #1: Type: text/plain, Size: 2926 bytes --]
On 11/18/2014 10:01 AM, Óscar Fuentes wrote:
> Daniel Colascione <dancol@dancol.org> writes:
>
>> On 11/18/2014 08:36 AM, Rüdiger Sonderfeld wrote:
>>> On Tuesday 18 November 2014 15:47:43 Óscar Fuentes wrote:
>>>> Daniel Colascione <dancol@dancol.org> writes:
>>>>>>> The "alignof" keyword is the only one still missing.
>>>>>>
>>>>>> From the top of my head: override is also missing.
>>>>>
>>>>> Because "override" (and "final") are keywords only in certain semantic
>>>>> contexts, supporting them requires special care.
>>>>
>>>> override and final have the same context as `const' for methods, so we
>>>> could take that as a model. Skimming over cc-langs.el didn't show an
>>>> obvious place for it, though.
>>>
>>> Yes, but "const" has a meaning in other places as well. That's why it is
>>> dealt with in `c-type-modifier-kwds'. I think the problem is similar for
>>> "noexcept". I've simply added it to `c-type-modifier-kwds' for now. But it's
>>> actually the wrong place. However unlike "override" and "final", there is
>>> also an operator version of "noexcept".
>>
>> C++11 introduced the noexcept and constexpr keywords. They're always
>> keywords. "override" and "final" are different. Please don't go hack
>> those into cc-engine. Better to leave them unfontified than to fontify
>> perfectly good identifiers as keywords.
>
> Is this the problem? *If* hacking c-mode font-lock system ends with
> "override" and "final" fontified as specifiers, is that so terrible? Are
> those identifiers so popular? C-mode already gets confused very often
> about how to fontify certain non-C-ish chunks of C++ code, so having
> "override" and "final" fontified as specifiers everywhere seems a
> non-issue to me. What's more annoying is to not fontify them on method
> declarations, because my first reaction when glancing at that code is to
> assume a typo.
Patch cc-engine to recognize the proper context if you care so much. Until you can do that, do not touch cc-mode.
>> They're not like "const" at all.
>
> As far as c-mode is concerned, they are like "certain variety of const."
No, lexically, they are completely different. You cannot have a variable called "const". You can have a variable called "final".
> If c-mode uses the same heuristics everywhere for fontifying `const',
> that means that we cannot exploit the existing mechanism for fontifying
> "override" and "final". To bad. Then I would vote for adding them to
> some list of keywords. As I said, not having them fontified when they
> should is worse than having them fontified when they shouldn't.
Do not introduce bugs into Emacs cc-mode. It's one of Emacs most widely used features and will not change to suit your non-universal preferences. If you want to err on the side of over-highlighting, you are free to create a derived mode locally.
Do it right or not at all.
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
next prev parent reply other threads:[~2014-11-18 18:11 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-25 12:51 [PATCH] support a few of the new features of C++11 in syntax highlighting Paul Pogonyshev
2014-01-25 19:58 ` Glenn Morris
2014-01-25 21:56 ` Stefan Monnier
2014-01-25 22:34 ` Daniel Colascione
2014-01-26 0:27 ` Glenn Morris
2014-01-26 12:29 ` Daniel Colascione
2014-01-26 15:21 ` Alan Mackenzie
2014-05-11 6:48 ` Václav Zeman
2014-05-11 16:00 ` Óscar Fuentes
2014-05-11 18:21 ` Glenn Morris
2014-05-11 20:19 ` Óscar Fuentes
2014-05-11 22:09 ` Alan Mackenzie
2014-05-11 22:38 ` Óscar Fuentes
2014-05-14 20:13 ` Alan Mackenzie
2014-05-14 21:20 ` Óscar Fuentes
2014-05-15 1:52 ` Stefan Monnier
2014-05-16 16:07 ` Alan Mackenzie
2014-05-16 17:59 ` Eli Zaretskii
2014-05-17 8:31 ` Alan Mackenzie
2014-05-17 9:24 ` Eli Zaretskii
2014-05-17 12:39 ` Michael Albinus
2014-05-17 14:14 ` Stefan Monnier
2014-05-17 14:24 ` Michael Albinus
2014-05-17 15:10 ` Stefan Monnier
2014-05-17 13:27 ` Óscar Fuentes
2014-05-17 14:06 ` Eli Zaretskii
2014-05-16 23:42 ` Stefan Monnier
2014-05-17 4:17 ` Richard Stallman
2014-05-17 9:03 ` Alan Mackenzie
2014-05-17 15:45 ` Richard Stallman
2014-05-19 15:46 ` Barry Warsaw
2014-05-17 8:42 ` Alan Mackenzie
2014-05-17 14:09 ` Stefan Monnier
2014-11-16 17:36 ` Rüdiger Sonderfeld
2014-11-16 18:07 ` Óscar Fuentes
2014-11-18 2:41 ` Rüdiger Sonderfeld
2014-11-18 3:30 ` Óscar Fuentes
2014-11-18 12:48 ` Daniel Colascione
2014-11-18 14:47 ` Óscar Fuentes
2014-11-18 16:36 ` Rüdiger Sonderfeld
2014-11-18 17:13 ` Daniel Colascione
2014-11-18 18:01 ` Óscar Fuentes
2014-11-18 18:11 ` Daniel Colascione [this message]
2014-11-18 18:33 ` Óscar Fuentes
2014-11-18 12:49 ` Daniel Colascione
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=546B8BED.9050208@dancol.org \
--to=dancol@dancol.org \
--cc=emacs-devel@gnu.org \
--cc=ofv@wanadoo.es \
/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.