[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, 21 May 2019 10:32:54 +0000 |
User-agent: |
Mutt/1.10.1 (2018-07-13) |
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 <address@hidden> 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 "\\<DEFUN\\>")
- (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).