unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* linux kernel C style
@ 2010-07-08 18:56 Dimitrios Apostolou
  0 siblings, 0 replies; only message in thread
From: Dimitrios Apostolou @ 2010-07-08 18:56 UTC (permalink / raw)
  To: help-gnu-emacs

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




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-07-08 18:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-08 18:56 linux kernel C style Dimitrios Apostolou

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