[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#6617: linux kernel C style (fwd)
From: |
Alan Mackenzie |
Subject: |
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@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).