From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.devel Subject: Re: [handa@m17n.org: C indentation problem] Date: Tue, 21 May 2019 10:32:54 +0000 Message-ID: <20190521103254.GA4706@ACM> References: <87muk7hc46.fsf@tcd.ie> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="59478"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mutt/1.10.1 (2018-07-13) Cc: emacs-devel@gnu.org, rms@gnu.org, Kenichi Handa To: "Basil L. Contovounesios" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue May 21 12:33:07 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hT24x-000FMI-KX for ged-emacs-devel@m.gmane.org; Tue, 21 May 2019 12:33:07 +0200 Original-Received: from localhost ([127.0.0.1]:51046 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hT24w-0000XF-Hz for ged-emacs-devel@m.gmane.org; Tue, 21 May 2019 06:33:06 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:52641) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hT24q-0000XA-Bp for emacs-devel@gnu.org; Tue, 21 May 2019 06:33:01 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hT24p-00034n-Ck for emacs-devel@gnu.org; Tue, 21 May 2019 06:33:00 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:28120 helo=mail.muc.de) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1hT24p-00032i-23 for emacs-devel@gnu.org; Tue, 21 May 2019 06:32:59 -0400 Original-Received: (qmail 93612 invoked by uid 3782); 21 May 2019 10:32:55 -0000 Original-Received: from acm.muc.de (p4FE15C6E.dip0.t-ipconnect.de [79.225.92.110]) by colin.muc.de (tmda-ofmipd) with ESMTP; Tue, 21 May 2019 12:32:54 +0200 Original-Received: (qmail 5349 invoked by uid 1000); 21 May 2019 10:32:54 -0000 Content-Disposition: inline In-Reply-To: <87muk7hc46.fsf@tcd.ie> 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 [fuzzy] X-Received-From: 193.149.48.1 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 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" Xref: news.gmane.org gmane.emacs.devel:236852 Archived-At: Hello, Basil. Sorry I missed this post when you posted it at the end of April. The issue goes back to 2006. ;-) On Tue, Apr 30, 2019 at 14:11:05 +0100, Basil L. Contovounesios wrote: > Kenichi Handa writes: [ .... ] > > Ah! Yes. I personally prefer Emacs 21 style (perhaps just > > because I used to it for long time). > >> However, CC Mode 5.28 seems to me to indent like the Emacs 22 sources are > >> indented, i.e. column 5, and 5. > CC Mode 5.33.2 also indents "Emacs 22-style", i.e. to 5 columns, but the > current sources, AFAICS, are indented to 2 columns, "Emacs 21-style". More to the point, we no longer have knr declarations. > >> I suggest the following: a new lineup function, > >> c-lineup-gnu-DEFUN-intro-cont which would be active only in GNU style, > >> and would give the offset knr-argdecl-intro (i.e. 5) for the lines > >> between DEFUN's closing paren and the function's opening brace. This new > >> function would be tried only if the existing c-lineup-topmost-intro-cont > >> returns nil. > Shouldn't the now-existing c-lineup-gnu-DEFUN-intro-cont be changed > accordingly, to indent to 2 columns instead of 5? Seeing as how we don't have knr declarations any more, it seems senseless now to indent with the CC Mode syntactic symbol knr-argdecl-intro, i.e. 5. Instead c-basic-offset (2) seems right. How about the following patch? diff -r f9e4e46ed54d cc-align.el --- a/cc-align.el Mon May 20 12:34:51 2019 +0000 +++ b/cc-align.el Tue May 21 10:24:11 2019 +0000 @@ -112,7 +112,7 @@ (let (case-fold-search) (goto-char (c-langelem-pos langelem)) (if (looking-at "\\") - (c-calc-offset '(knr-argdecl-intro)))))) + c-basic-offset)))) (defun c-block-in-arglist-dwim (arglist-start) ;; This function implements the DWIM to avoid far indentation of > >> Question: Are there any other C macros, besides DEFUN, whose indentation > >> is also broken at the moment? (I do not know the C source at all well.) > > All I noticed is the DEFUN case. > I too have yet to notice a problem with other macros. That's good. > Thanks, > -- > Basil -- Alan Mackenzie (Nuremberg, Germany).