--- Begin Message ---
Subject: |
linux kernel C style (fwd) |
Date: |
Mon, 12 Jul 2010 13:08:42 +0300 (EEST) |
User-agent: |
Alpine 2.00 (LNX 1167 2008-08-23) |
Hi, I sent the following to help-gnu-emacs and got no reply, maybe this
list is more relevant.
---------- Forwarded message ----------
Date: Thu, 8 Jul 2010 21:56:09 +0300 (EEST)
From: Dimitrios Apostolou <jimis@gmx.net>
To: help-gnu-emacs@gnu.org
Subject: linux kernel C style
Hello list,
is the "linux" c-style supposed to be compliant to the linux kernel style
guidelines? I just realised that all this time emacs was indenting my code
slightly wrong, specifically the use of spaces is forbidden, even when
continuing the argument list of a function.
I use the following lines in my .emacs, taken from Documentation/CodingStyle of
the kernel tree. Perhaps they should be added to "linux" style?
(defun c-lineup-arglist-tabs-only (ignored)
"Line up argument lists by tabs, not spaces"
(let* ((anchor (c-langelem-pos c-syntactic-element))
(column (c-langelem-2nd-pos c-syntactic-element))
(offset (- (1+ column) anchor))
(steps (floor offset c-basic-offset)))
(* (max steps 1)
c-basic-offset)))
;; Add kernel style
(c-add-style
"linux-tabs-only"
'("linux" (c-offsets-alist
(arglist-cont-nonempty
c-lineup-gcc-asm-reg
c-lineup-arglist-tabs-only))))
(custom-set-variables
'(c-default-style "linux-tabs-only")
)
Thanks,
Dimitris
--- End Message ---
--- Begin Message ---
Subject: |
Re: bug#6617: linux kernel C style (fwd) |
Date: |
Wed, 27 Apr 2022 19:17:52 +0000 |
Hello, everybody.
On Sun, Apr 24, 2022 at 14:16:23 -0700, Sean Whitton wrote:
> Hello Alan,
> On Sun 24 Apr 2022 at 02:50PM GMT, Alan Mackenzie wrote:
> > After a bit of thought, I agree with you. I think here it is better
> > just to add the setting of indent-tabs-mode to the "linux" style. Most
> > users of "linux" will have that variable set to t one way or another,
> > and so won't notice.
> > There will be a few users using the style for non-Linux projects, who
> > will be used to indent-tabs-mode being nil. That is just unfortunate.
> > I think the balance of benefits and problems comes down on the side of
> > this abrupt change.
> Right.
> > I intend to apply the following patch to cc-styles.el soon. If you
> > want to test it you're very welcome, but please note that since it
> > changes a variable, the amended CC Mode should be the first CC Mode
> > you load in the Emacs session. (Otherwise, you'll need to do fancy
> > things with `makunbound' before loading the new CC Mode.)
> I'm not in the middle of any C projects using the Linux style atm, so I
> don't think I'll be able to test, but your patch looks basically
> equivalent to the "linux-tabs" thing I was doing, so probably doesn't
> need a lot of testing. Thanks for thinking this one over!
I've now committed the change to cc-styles.el, and am closing the bug
with this post.
> --
> Sean Whitton
--
Alan Mackenzie (Nuremberg, Germany).
--- End Message ---