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: [handa@m17n.org: C indentation problem] Date: Tue, 18 Apr 2006 22:15:00 +0000 (GMT) Message-ID: References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Trace: sea.gmane.org 1145398218 29416 80.91.229.2 (18 Apr 2006 22:10:18 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 18 Apr 2006 22:10:18 +0000 (UTC) Cc: bug-cc-mode@gnu.org, Richard Stallman Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Apr 19 00:10:16 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 1FVyOg-0001SO-Dv for ged-emacs-devel@m.gmane.org; Wed, 19 Apr 2006 00:10:10 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FVyOf-0005uC-HL for ged-emacs-devel@m.gmane.org; Tue, 18 Apr 2006 18:10:09 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FVyOR-0005sl-9S for emacs-devel@gnu.org; Tue, 18 Apr 2006 18:09:55 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FVyOP-0005rx-PP for emacs-devel@gnu.org; Tue, 18 Apr 2006 18:09:54 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FVyOP-0005rr-DE for emacs-devel@gnu.org; Tue, 18 Apr 2006 18:09:53 -0400 Original-Received: from [193.149.49.134] (helo=acm.acm) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FVyPH-0005qx-Ea; Tue, 18 Apr 2006 18:10:48 -0400 Original-Received: from localhost (root@localhost) by acm.acm (8.8.8/8.8.8) with SMTP id WAA01161; Tue, 18 Apr 2006 22:15:01 GMT X-Sender: root@acm.acm Original-To: Kenichi Handa , emacs-devel@gnu.org In-Reply-To: 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:53035 Archived-At: Hi, Kenichi! On Wed, 12 Apr 2006, Richard Stallman wrote: >Would you please DTRT and ack: >------- Start of forwarded message ------- >From: Kenichi Handa >To: emacs-devel@gnu.org >Date: Wed, 12 Apr 2006 14:37:14 +0900 >Subject: C indentaion problem >X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=failed > version=3.0.4 >In the latest CVS code, arguments following DEFUN macro (in >Emacs C source files) is not indented as before. >For instance, when I visit src/cmds.c, i-search DEFUN (and >find "forward-point"), move cursor to the argument line >(that is " (n)"), and type TAB, "(n)" is moved to BOL. >I remember that such an argument line was indented by 2 >columns, and the following type-declaration line was >indented by 5 columns before. At least Emacs did that until >CC Mode was updated to 5.31 on 2005-12-08. 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. ######################################################################### 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. 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. 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.) What do you Think? >Kenichi Handa -- Alan Mackenzie (Munich, Germany)