From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.devel Subject: Re: "enum class" supports for cc-mode Date: Thu, 30 Oct 2014 16:21:45 +0000 Message-ID: <20141030162145.GA2721@acm.acm> References: <544E9099.7030409@dancol.org> <20141029164915.GC2953@acm.acm> <54511DA4.4060002@dancol.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1414779099 15338 80.91.229.3 (31 Oct 2014 18:11:39 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 31 Oct 2014 18:11:39 +0000 (UTC) Cc: Emacs developers To: Daniel Colascione Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Oct 31 19:11:32 2014 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XkGfb-0002yw-Q5 for ged-emacs-devel@m.gmane.org; Fri, 31 Oct 2014 19:11:31 +0100 Original-Received: from localhost ([::1]:40509 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XkGfb-0005m8-6K for ged-emacs-devel@m.gmane.org; Fri, 31 Oct 2014 14:11:31 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44044) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XkEI7-0005ea-LL for emacs-devel@gnu.org; Fri, 31 Oct 2014 11:40:01 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XjsUZ-0002tV-D6 for emacs-devel@gnu.org; Thu, 30 Oct 2014 12:22:38 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:21392 helo=mail.muc.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XjsUZ-0002sR-3y for emacs-devel@gnu.org; Thu, 30 Oct 2014 12:22:31 -0400 Original-Received: (qmail 53887 invoked by uid 3782); 30 Oct 2014 16:22:28 -0000 Original-Received: from acm.muc.de (pD9518F96.dip0.t-ipconnect.de [217.81.143.150]) by colin.muc.de (tmda-ofmipd) with ESMTP; Thu, 30 Oct 2014 17:22:28 +0100 Original-Received: (qmail 2791 invoked by uid 1000); 30 Oct 2014 16:21:45 -0000 Content-Disposition: inline In-Reply-To: <54511DA4.4060002@dancol.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de X-detected-operating-system: by eggs.gnu.org: FreeBSD 8.x X-Received-From: 193.149.48.1 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:176116 Archived-At: 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).