From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dimitrios Apostolou Newsgroups: gmane.emacs.bugs Subject: bug#6617: linux kernel C style (fwd) Date: Tue, 13 Jul 2010 12:17:38 +0300 (EEST) Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Trace: dough.gmane.org 1279017340 10083 80.91.229.12 (13 Jul 2010 10:35:40 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 13 Jul 2010 10:35:40 +0000 (UTC) Cc: 6617@debbugs.gnu.org To: Dan Nicolaescu Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Jul 13 12:35:36 2010 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OYcpo-0000dL-49 for geb-bug-gnu-emacs@m.gmane.org; Tue, 13 Jul 2010 12:35:32 +0200 Original-Received: from localhost ([127.0.0.1]:39395 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OYcpn-0002dV-H0 for geb-bug-gnu-emacs@m.gmane.org; Tue, 13 Jul 2010 06:35:31 -0400 Original-Received: from [140.186.70.92] (port=56215 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OYcpa-0002cW-Qo for bug-gnu-emacs@gnu.org; Tue, 13 Jul 2010 06:35:24 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OYcpX-0004VS-M0 for bug-gnu-emacs@gnu.org; Tue, 13 Jul 2010 06:35:18 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:34849) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OYckf-0003ps-FR; Tue, 13 Jul 2010 06:30:13 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1OYcYs-0000Ob-3F; Tue, 13 Jul 2010 06:18:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dimitrios Apostolou Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org, bug-cc-mode@gnu.org Resent-Date: Tue, 13 Jul 2010 10:18:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 6617 X-GNU-PR-Package: emacs,cc-mode X-GNU-PR-Keywords: Original-Received: via spool by 6617-submit@debbugs.gnu.org id=B6617.12790162391503 (code B ref 6617); Tue, 13 Jul 2010 10:18:02 +0000 Original-Received: (at 6617) by debbugs.gnu.org; 13 Jul 2010 10:17:19 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OYcYA-0000OC-Fb for submit@debbugs.gnu.org; Tue, 13 Jul 2010 06:17:19 -0400 Original-Received: from mailout-de.gmx.net ([213.165.64.23] helo=mail.gmx.net) by debbugs.gnu.org with smtp (Exim 4.69) (envelope-from ) id 1OYbaU-0008Os-K0 for 6617@debbugs.gnu.org; Tue, 13 Jul 2010 05:15:39 -0400 Original-Received: (qmail invoked by alias); 13 Jul 2010 09:15:42 -0000 Original-Received: from unknown (EHLO thanos-desktop.ics.forth.gr) [139.91.92.11] by mail.gmx.net (mp007) with SMTP; 13 Jul 2010 11:15:42 +0200 X-Authenticated: #4463548 X-Provags-ID: V01U2FsdGVkX1+qlhMNNbyqkvDCSYnJ5UxGG/PblKOgo4Dlvt5qBS QnQJzar6IDuSUf X-X-Sender: jimis@localhost.localdomain In-Reply-To: User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) X-Y-GMX-Trusted: 0 X-Mailman-Approved-At: Tue, 13 Jul 2010 06:17:17 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Tue, 13 Jul 2010 06:18:02 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:38480 Archived-At: On Tue, 13 Jul 2010, Dan Nicolaescu wrote: > Dimitrios Apostolou writes: > >> 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 >> 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. > > Is that really the case? Is this requirement documented anywhere? In the file Documentation/CodingStyle search for "emacs". Warning: the language is a bit toxic for emacs devs/users. There is also another point which is not clear but says the following: 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) > { > [snip] > > The arguments starting from sd_shares are indented using a few tabs > followed by a few spaces. > The above is not the only occurrence, there are many others in the same file. My guess is that those are inconsistencies caused by the current "linux" style in emacs, but perhaps this should be posted to LKML to verify. > > > Another point: to enforce the use of the correct style, a file called > .dir-locals.el should be placed at the top level of the kernel tree > with the following [completely untested] contents: > > ((c-mode . ((c-file-style . "linux") > (tab-width . 8) > (indent-tabs-mode . t)))) > > With this users of emacs-23+ will get the correct settings for editing > the kernel by default. > > Thanks, Dimitris