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 indentation in GNU style in c-mode is inconsistent Date: Mon, 27 Jul 2015 10:55:15 +0000 Message-ID: <20150727105515.GA3220@acm.fritz.box> References: <55B552AF.1040909@mcmackins.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1437994497 1918 80.91.229.3 (27 Jul 2015 10:54:57 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 27 Jul 2015 10:54:57 +0000 (UTC) Cc: emacs-devel@gnu.org To: David McMackins Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jul 27 12:54:44 2015 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 1ZJg3O-0002ka-Uk for ged-emacs-devel@m.gmane.org; Mon, 27 Jul 2015 12:54:43 +0200 Original-Received: from localhost ([::1]:52627 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZJg3O-0000bS-41 for ged-emacs-devel@m.gmane.org; Mon, 27 Jul 2015 06:54:42 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37720) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZJg3J-0000XG-5v for emacs-devel@gnu.org; Mon, 27 Jul 2015 06:54:38 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZJg3D-00043L-0s for emacs-devel@gnu.org; Mon, 27 Jul 2015 06:54:37 -0400 Original-Received: from mail.muc.de ([193.149.48.3]:50588) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZJg3C-00042G-Oe for emacs-devel@gnu.org; Mon, 27 Jul 2015 06:54:30 -0400 Original-Received: (qmail 45295 invoked by uid 3782); 27 Jul 2015 10:54:28 -0000 Original-Received: from acm.muc.de (p5B14657D.dip0.t-ipconnect.de [91.20.101.125]) by colin.muc.de (tmda-ofmipd) with ESMTP; Mon, 27 Jul 2015 12:54:27 +0200 Original-Received: (qmail 3331 invoked by uid 1000); 27 Jul 2015 10:55:15 -0000 Content-Disposition: inline In-Reply-To: <55B552AF.1040909@mcmackins.org> User-Agent: Mutt/1.5.23 (2014-03-12) X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de X-detected-operating-system: by eggs.gnu.org: FreeBSD 9.x X-Received-From: 193.149.48.3 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:188105 Archived-At: Hello, David. On Sun, Jul 26, 2015 at 04:35:43PM -0500, David McMackins wrote: > As pointed out in an e-mail from last year, the GNU style C indentation > in Emacs is wrong for enumerated types. The user who wrote it said that > the bug should not be fixed because it would case creeping changes in > the GNU code base over a long period of time. That would almost certainly have been me. > While that is true, one large problem is inconsistency. I have gotten > Emacs into a state where the enum indentation would actually be true to > GNU coding standards through some messing about with opening and closing > braces in a header file, .... Sorry, but there're too many prepositions in that paragraph for me to be sure of your meaning. By "gotten Emacs into a state where ..." do you mean that you've got the indentation in a particular buffer to be standards-correct, or that you've configured C Mode to indent standards-correctly when it does indentation (e.g. with )? > ...., but if I reload c-mode, it goes back to the way it was before. Restarting C Mode doesn't change any existing indentation, so by "it", do you mean "the C mode configuration of indentation operations"? > I do think this should be fixed, since one of the primary reasons I use > Emacs is its correct indentation in many C styles. As I explained last year, I don't want to correct this bug in GNU style indentation, because that would make a (very) large quantity of existing source code's indentation unstable. I'm guessing here, but I think what you've done is, after starting C Mode, you've configured indentation of enums to be standards-correct on-the-fly. And that each time C Mode is (re-)started, this on-the-fly configuration is lost. This is naturally irritating and tedious. What I think the best thing for you to do here is to create a CC Mode style of your own, which "inherits" from the GNU style, and sets its own indentation for enums. This would be in your .emacs, and once set up, would work without further tedium. The setting up of styles is described in the CC Mode manual, in particular you should read the pages "Config Basics", "Styles" and some of its subpages, and there is an example of setting up a style in "Sample .emacs file". Alternatively, you could clarify the points here, then ask me to create the style for you. :-) > Happy Hacking, and yourself too, Sir! > David E. McMackins II > Associate, Free Software Foundation (#12889) > www.mcmackins.org www.delwink.com > www.gnu.org www.fsf.org -- Alan Mackenzie (Nuremberg, Germany).