Skip site navigation (1)Skip section navigation (2)
Date:      24 Jan 2001 15:32:00 +0100
From:      Dag-Erling Smorgrav <des@ofug.org>
To:        Alexander Langer <alex@big.endian.de>
Cc:        Jonathon McKitrick <jcm@shellyeah.org>, Stephen McKay <mckay@thehub.com.au>, j mckitrick <jcm@FreeBSD-uk.eu.org>, chat@FreeBSD.ORG
Subject:   Re: good example kernel code
Message-ID:  <xzphf2p2f8f.fsf@flood.ping.uio.no>
In-Reply-To: Alexander Langer's message of "Wed, 24 Jan 2001 12:41:43 %2B0100"
References:  <20010124122137.A13335@cichlids.cichlids.com> <Pine.GSO.4.21.0101240625560.14282-100000@zippy.shellyeah.org> <20010124124143.A14098@cichlids.cichlids.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Alexander Langer <alex@big.endian.de> writes:
> I'd love sys/kern/subr_bus.c, if it didn't use four spaces for second
> level indents for functions, but indent the args to the opening
> paranthesis (as the ed drivers does, btw).

The ed driver is wrong, subr_bus.c is right. If the reason why you
dislike this is that Emacs can't handle it, try:

;;
;; Style(9)-compliant C mode settings
;;
(defun knf-c-mode-hook ()
  ;; BSD-style indentation
  (c-set-style "bsd")
  
  ;; Basic indent is 8 spaces
  (make-local-variable 'c-basic-offset)
  (setq c-basic-offset 8)

  ;; Continuation lines are indented 4 spaces
  (c-set-offset 'statement-cont 4 t)
  (c-set-offset 'arglist-cont 4 t)
  (c-set-offset 'arglist-cont-nonempty 4 t)

  ;; Auto-indent
  (local-set-key "\C-m" 'newline-and-indent))

(add-hook 'c-mode-hook 'knf-c-mode-hook)

I have a variation of this in my .emacs.el, which enables style(9)
mode only if buffer-file-name contains "src/sys".

Another part of the kernel that should be fairly style(9)-compliant is
subr_sbuf.c - at least, I tried to make it so.

DES
-- 
Dag-Erling Smorgrav - des@ofug.org


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-chat" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?xzphf2p2f8f.fsf>