GNU bug report logs - #6617
linux kernel C style (fwd)

Previous Next

Packages: emacs, cc-mode;

Reported by: Dimitrios Apostolou <jimis <at> gmx.net>

Date: Mon, 12 Jul 2010 10:36:01 UTC

Severity: normal

Done: Alan Mackenzie <acm <at> muc.de>

Bug is archived. No further changes may be made.

Full log


Message #29 received at 6617 <at> debbugs.gnu.org (full text, mbox):

From: Alan Mackenzie <acm <at> muc.de>
To: Sean Whitton <spwhitton <at> spwhitton.name>
Cc: Dan Nicolaescu <dann <at> gnu.org>, Lars Ingebrigtsen <larsi <at> gnus.org>,
 Dimitrios Apostolou <jimis <at> gmx.net>, 6617 <at> debbugs.gnu.org, acm <at> muc.de
Subject: Re: bug#6617: linux kernel C style (fwd)
Date: Sun, 24 Apr 2022 14:50:42 +0000
Hello, Sean.

On Mon, Apr 18, 2022 at 11:30:04 -0700, Sean Whitton wrote:
> Hello,

> On Thu 09 Sep 2021 at 04:00PM +02, Lars Ingebrigtsen wrote:

> > Sean Whitton <spwhitton <at> spwhitton.name> writes:

> >> The Linux kernel style is tabs only.  I think that Emacs DTRT if
> >> indent-tabs-mode is t.  So, currently I have this fix in my init file:

> >>     (c-add-style "linux-tabs" '("linux" (indent-tabs-mode . t)))
> >>     (setq c-default-style "linux-tabs")

> > Right.  Alan, would it make sense to add this style to c-mode?

> Were you thinking it would be too much of a compat break to just edit
> the linux style to include setting indent-tabs-mode?  I think that would
> be a lot more useful.  Anyone who actually wants the Linux kernel's
> style would want (what I've called) linux-tabs.

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.

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.)



diff -r 8fd64e3084ac cc-styles.el
--- a/cc-styles.el	Sat Apr 23 19:17:52 2022 +0000
+++ b/cc-styles.el	Sun Apr 24 14:36:46 2022 +0000
@@ -187,6 +187,7 @@
 			 (inclass              . +)
 			 (inline-open          . 0))))
     ("linux"
+     (indent-tabs-mode . t)
      (c-basic-offset  . 8)
      (c-comment-only-line-offset . 0)
      (c-hanging-braces-alist . ((brace-list-open)


> -- 
> Sean Whitton

-- 
Alan Mackenzie (Nuremberg, Germany).




This bug report was last modified 3 years and 103 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.