bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#6617: linux kernel C style (fwd)


From: Sean Whitton
Subject: bug#6617: linux kernel C style (fwd)
Date: Wed, 08 Sep 2021 11:29:10 -0700
User-agent: Notmuch/0.31.4 (https://notmuchmail.org) Emacs/28.0.50 (x86_64-pc-linux-gnu)

Hello,

On Wed 08 Sep 2021 at 10:40AM +02, Lars Ingebrigtsen wrote:

> Dan Nicolaescu <dann@gnu.org> writes:
>
>> Statements longer than 80 columns will be broken into sensible
>> chunks. Descendants are always substantially shorter than the parent
>> and are placed substantially to the right. The same applies to
>> function headers with a long argument list. Long strings are as well
>> broken into shorter strings. The only exception to this is where
>> exceeding 80 columns significantly increases readability and does not
>> hide information.
>>
>> It is then followed by an example which is is indented only with tabs.
>>
>>> Looking at a random file in the linux-2.6.34.1 kernel:
>>> kernel/sched.c one can see:
>>>
>>> static void update_group_shares_cpu(struct task_group *tg, int cpu,
>>>                                 unsigned long sd_shares,
>>>                                 unsigned long sd_rq_weight,
>>>                                 unsigned long *usd_rq_weight)
>>> {
>
> (I'm going through old bug reports that unfortunately weren't resolved
> at the time.)
>
> It still seems to be the case that the "linux" style indents using both
> tabs and spaces in Emacs 28.  I don't know what the Linux kernel style
> is these days, but the suggestion in this bug report is to add a
> tab-only variant.  Alan, do you have any comments about this?

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

-- 
Sean Whitton





reply via email to

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