unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Sean Whitton <spwhitton@spwhitton.name>
To: Lars Ingebrigtsen <larsi@gnus.org>, Dan Nicolaescu <dann@gnu.org>
Cc: Alan Mackenzie <acm@muc.de>, Dimitrios Apostolou <jimis@gmx.net>,
	6617@debbugs.gnu.org
Subject: bug#6617: linux kernel C style (fwd)
Date: Wed, 08 Sep 2021 11:29:10 -0700	[thread overview]
Message-ID: <871r5yyl8p.fsf@melete.silentflame.com> (raw)
In-Reply-To: <87ee9z4g00.fsf@gnus.org>

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	other threads:[~2021-09-08 18:29 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-12 10:08 bug#6617: linux kernel C style (fwd) Dimitrios Apostolou
2010-07-13  8:51 ` Dan Nicolaescu
2010-07-13  9:17   ` Dimitrios Apostolou
2010-07-13 12:51     ` Dan Nicolaescu
2021-09-08  8:40   ` Lars Ingebrigtsen
2021-09-08 18:29     ` Sean Whitton [this message]
2021-09-09 14:00       ` Lars Ingebrigtsen
2022-04-18 18:30         ` Sean Whitton
2022-04-24 14:50           ` Alan Mackenzie
2022-04-24 21:16             ` Sean Whitton
2022-04-27 19:17               ` Alan Mackenzie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=871r5yyl8p.fsf@melete.silentflame.com \
    --to=spwhitton@spwhitton.name \
    --cc=6617@debbugs.gnu.org \
    --cc=acm@muc.de \
    --cc=dann@gnu.org \
    --cc=jimis@gmx.net \
    --cc=larsi@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).