From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dan Nicolaescu Newsgroups: gmane.emacs.bugs Subject: bug#6617: linux kernel C style (fwd) Date: Tue, 13 Jul 2010 08:51:30 -0400 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1279026034 8251 80.91.229.12 (13 Jul 2010 13:00:34 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 13 Jul 2010 13:00:34 +0000 (UTC) Cc: 6617@debbugs.gnu.org To: Dimitrios Apostolou Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Jul 13 15:00:29 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 1OYf64-0002Bx-Qf for geb-bug-gnu-emacs@m.gmane.org; Tue, 13 Jul 2010 15:00:29 +0200 Original-Received: from localhost ([127.0.0.1]:37233 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OYf63-00020y-6d for geb-bug-gnu-emacs@m.gmane.org; Tue, 13 Jul 2010 09:00:27 -0400 Original-Received: from [140.186.70.92] (port=39846 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OYf5v-0001za-1x for bug-gnu-emacs@gnu.org; Tue, 13 Jul 2010 09:00:20 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OYf5t-0003SB-9A for bug-gnu-emacs@gnu.org; Tue, 13 Jul 2010 09:00:18 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:50182) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OYf5p-0003R9-MZ; Tue, 13 Jul 2010 09:00:13 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1OYext-00028z-La; Tue, 13 Jul 2010 08:52:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dan Nicolaescu 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 12:52:01 +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.12790254868234 (code B ref 6617); Tue, 13 Jul 2010 12:52:01 +0000 Original-Received: (at 6617) by debbugs.gnu.org; 13 Jul 2010 12:51:26 +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 1OYexK-00028l-A3 for submit@debbugs.gnu.org; Tue, 13 Jul 2010 08:51:26 -0400 Original-Received: from fencepost.gnu.org ([140.186.70.10]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OYexI-00028e-UG for 6617@debbugs.gnu.org; Tue, 13 Jul 2010 08:51:25 -0400 Original-Received: from dann by fencepost.gnu.org with local (Exim 4.69) (envelope-from ) id 1OYexO-0007dl-99; Tue, 13 Jul 2010 08:51:30 -0400 In-Reply-To: (Dimitrios Apostolou's message of "Tue\, 13 Jul 2010 12\:17\:38 +0300 \(EEST\)") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Tue, 13 Jul 2010 08:52:01 -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:38486 Archived-At: Dimitrios Apostolou writes: > 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's code there that seems to do what you stated, but there seems to be no text that actually describes that... > 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. Please do that and report the conclusion here. >> 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