all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: Daniel Colascione <dancol@dancol.org>
Cc: Emacs developers <emacs-devel@gnu.org>
Subject: Re: "enum class" supports for cc-mode
Date: Thu, 30 Oct 2014 16:21:45 +0000	[thread overview]
Message-ID: <20141030162145.GA2721@acm.acm> (raw)
In-Reply-To: <54511DA4.4060002@dancol.org>

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	other threads:[~2014-10-30 16:21 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-27 18:36 "enum class" supports for cc-mode Daniel Colascione
2014-10-29 16:49 ` Alan Mackenzie
2014-10-29 17:02   ` Daniel Colascione
2014-10-30 16:21     ` Alan Mackenzie [this message]
2014-10-30 18:56       ` Daniel Colascione
2014-10-31 20:35       ` Glenn Morris
2014-11-01 10:39         ` 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=20141030162145.GA2721@acm.acm \
    --to=acm@muc.de \
    --cc=dancol@dancol.org \
    --cc=emacs-devel@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 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.