From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kenichi Handa Newsgroups: gmane.emacs.devel Subject: Re: [handa@m17n.org: C indentation problem] Date: Wed, 19 Apr 2006 10:30:18 +0900 Message-ID: References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 (generated by SEMI 1.14.3 - "Ushinoya") Content-Type: text/plain; charset=US-ASCII X-Trace: sea.gmane.org 1145410261 26883 80.91.229.2 (19 Apr 2006 01:31:01 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 19 Apr 2006 01:31:01 +0000 (UTC) Cc: bug-cc-mode@gnu.org, rms@gnu.org, emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Apr 19 03:30:56 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1FW1Wm-0004kY-TN for ged-emacs-devel@m.gmane.org; Wed, 19 Apr 2006 03:30:46 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FW1Wj-0005z6-Uj for ged-emacs-devel@m.gmane.org; Tue, 18 Apr 2006 21:30:41 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FW1WY-0005yQ-36 for emacs-devel@gnu.org; Tue, 18 Apr 2006 21:30:30 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FW1WV-0005y1-Ud for emacs-devel@gnu.org; Tue, 18 Apr 2006 21:30:29 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FW1WV-0005xy-S1 for emacs-devel@gnu.org; Tue, 18 Apr 2006 21:30:27 -0400 Original-Received: from [192.47.44.130] (helo=tsukuba.m17n.org) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1FW1XS-0003c6-5o; Tue, 18 Apr 2006 21:31:26 -0400 Original-Received: from nfs.m17n.org (nfs.m17n.org [192.47.44.7]) by tsukuba.m17n.org (8.13.4/8.13.4/Debian-3sarge1) with ESMTP id k3J1UJBq000799; Wed, 19 Apr 2006 10:30:19 +0900 Original-Received: from etlken (etlken.m17n.org [192.47.44.125]) by nfs.m17n.org (8.13.4/8.13.4/Debian-3sarge1) with ESMTP id k3J1UJqG025467; Wed, 19 Apr 2006 10:30:19 +0900 Original-Received: from handa by etlken with local (Exim 3.36 #1 (Debian)) id 1FW1WM-0001Mg-00; Wed, 19 Apr 2006 10:30:18 +0900 Original-To: Alan Mackenzie In-reply-to: (message from Alan Mackenzie on Tue, 18 Apr 2006 22:15:00 +0000 (GMT)) User-Agent: SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.2 Emacs/22.0.50 (i686-pc-linux-gnu) MULE/5.0 (SAKAKI) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:53046 Archived-At: In article , Alan Mackenzie writes: > Sometime between Emacs 21 and Emacs 22 CVS, the indentation in the actual > source code was changed from: > Emacs 21 sources: > ######################################################################### > DEFUN ("forward-char", Fforward_char, Sforward_char, 0, 1, "p", > "Move point right N characters (left if N is negative).\n\ > On reaching end of buffer, stop and signal error.") > (n) <====== indentation of 2 columns. > Lisp_Object n; <====== indentation of 5 columns. > ######################################################################### > to > Emacs 22 sources: > ######################################################################### > DEFUN ("forward-char", Fforward_char, Sforward_char, 0, 1, "p", > doc: /* Move point right N characters (left if N is negative). > On reaching end of buffer, stop and signal error. */) > (n) <====== indentation of 5 columns. > Lisp_Object n; <====== indentation of 5 columns. > ######################################################################### 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. > The problem here is there is no Right Thing to do, since a C macro can > violate any syntactic rules. Consecutive parenthesis pairs are uncommon > in C. Yes. But, I noticed this: If I have a function without declaring the return type, I get this indentation (case1): test (a) int a; { } But, if I put the return type, I get this correct indentation (case2): int test (a) int a; { } And, if I insert extra parenthesis after the line of function name, I get this (case3): int test (a) (b) int a; { } And, when I delete "void" line, I get this (case 4): test (a) (b) int a; { } Is the difference of case1 and case2 (or case3 and case4) intentional? Isn't the case1 bug? Is the indentation of case3 ("(b)" is indented by 2-col) intentional? Is it difficult to treat case4 as the same way as case3? If that is possible, I think DEFUN case is solved because DEFUN syntax is the same as case4. > 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. I have no idea how adequate that method is. > 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. --- Kenichi Handa handa@m17n.org