emacs-devel
[Top][All Lists]
Advanced

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

Re: "enum class" supports for cc-mode


From: Alan Mackenzie
Subject: Re: "enum class" supports for cc-mode
Date: Thu, 30 Oct 2014 16:21:45 +0000
User-agent: Mutt/1.5.21 (2010-09-15)

Hello, Daniel.

On Wed, Oct 29, 2014 at 05:02:28PM +0000, Daniel Colascione wrote:
> On 10/29/2014 04:49 PM, Alan Mackenzie wrote:

> > On Mon, Oct 27, 2014 at 06:36:09PM +0000, Daniel Colascione wrote:
> >> Here's a small patch that teaches cc-mode about C++11 "enum class" syntax.
> >> See http://msdn.microsoft.com/en-us/library/2dzy4k6e.aspx

I've installed the patch.

Just as a matter of interest, I had to toughen up
c-backward-colon-prefixed-type, since it had supriously captured

    class Foo {
    public:
        enum {

, mistaking the colon after "public" for a colon inside an enum
declaration.

Also, in general, please prefer tabs to spaces for indentation in CC
Mode.  In cc-langs.el, there's no need for a blank line between
(c-lang-defconst foo ..) and (c-lang-defvar foo ...).

> Thanks.

> > Just one or two little details:
> > (i) You've used `eql' rather than `eq' for comparing things in a few
> >   places.  Is there any reason for this?

> eql is a good habit for numbers; = and eq would work just as well in
> these contexts though in Emacs.

OK.  I've left eql in.

> > (ii) c-after-brace-list-key will be "\\<\\>" (not nil) for non-C++
> >   languages, I think.  It's definition in cc-langs.el needs tweaking a
> >   bit to make it nil.

> Good point. Would you mind making this change?

My mistake - the "\\<\\>" value was needed somewhere else.  I changed the
test against nil to an `equal' test against "\\<\\>".  It seems to work.

> > (iii) There's a question as to whether the backward searching in
> >   c-backward-colon-prefixed-type should have an optional search limit.
> >   But the existing c-backward-over-enum-header doesn't, so that's
> >   something new to think about.

> I figure that the search will stop soon enough when we come across a
> token that can't be part of the enum header. Placing a generically
> correct bound on it seemed hard.

It is, isn't it.  What will cost is if there's an unbalanced close
paren/brace/bracket.  That might cause a lot of scanning from BOB.  I'll
have another look at this, sometime.

-- 
Alan Mackenzie (Nuremberg, Germany).



reply via email to

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