unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Dimitrios Apostolou <jimis@gmx.net>
To: help-gnu-emacs@gnu.org
Subject: linux kernel C style
Date: Thu, 8 Jul 2010 21:56:09 +0300 (EEST)	[thread overview]
Message-ID: <alpine.LNX.2.00.1007082145150.1500@localhost.localdomain> (raw)

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.

I use the following lines in my .emacs, taken from 
Documentation/CodingStyle of the kernel tree. Perhaps they should be added 
to "linux" style?


(defun c-lineup-arglist-tabs-only (ignored)
   "Line up argument lists by tabs, not spaces"
   (let* ((anchor (c-langelem-pos c-syntactic-element))
 	 (column (c-langelem-2nd-pos c-syntactic-element))
 	 (offset (- (1+ column) anchor))
 	 (steps (floor offset c-basic-offset)))
     (* (max steps 1)
        c-basic-offset)))

;; Add kernel style
(c-add-style
  "linux-tabs-only"
  '("linux" (c-offsets-alist
 	    (arglist-cont-nonempty
 	     c-lineup-gcc-asm-reg
 	     c-lineup-arglist-tabs-only))))

(custom-set-variables
  '(c-default-style "linux-tabs-only")
)


Thanks,
Dimitris




                 reply	other threads:[~2010-07-08 18:56 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=alpine.LNX.2.00.1007082145150.1500@localhost.localdomain \
    --to=jimis@gmx.net \
    --cc=help-gnu-emacs@gnu.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.
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).