emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: address@hidden: C indentation problem]


From: Alan Mackenzie
Subject: Re: address@hidden: C indentation problem]
Date: Tue, 18 Apr 2006 22:15:00 +0000 (GMT)

Hi, Kenichi!

On Wed, 12 Apr 2006, Richard Stallman wrote:

>Would you please DTRT and ack:

>------- Start of forwarded message -------
>From: Kenichi Handa <address@hidden>
>To: address@hidden
>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)






reply via email to

[Prev in Thread] Current Thread [Next in Thread]