From owner-freebsd-hackers@FreeBSD.ORG Mon Jul 16 15:00:51 2007 Return-Path: X-Original-To: freebsd-hackers@FreeBSD.org Delivered-To: freebsd-hackers@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5A43516A409 for ; Mon, 16 Jul 2007 15:00:51 +0000 (UTC) (envelope-from scf@FreeBSD.org) Received: from mail.farley.org (farley.org [67.64.95.201]) by mx1.freebsd.org (Postfix) with ESMTP id C5CCB13C4B8 for ; Mon, 16 Jul 2007 15:00:50 +0000 (UTC) (envelope-from scf@FreeBSD.org) Received: from thor.farley.org (thor.farley.org [192.168.1.5]) by mail.farley.org (8.14.1/8.14.1) with ESMTP id l6GESw7U014348; Mon, 16 Jul 2007 09:28:58 -0500 (CDT) (envelope-from scf@FreeBSD.org) Date: Mon, 16 Jul 2007 09:26:50 -0500 (CDT) From: "Sean C. Farley" To: Tom Evans In-Reply-To: <1184586173.2017.5.camel@localhost> Message-ID: <20070716090646.V27236@thor.farley.org> References: <43801.64.117.137.69.1180473436.squirrel@webmail.ifxnw.cl> <86abvm3k89.fsf@dwp.des.no> <1184586173.2017.5.camel@localhost> MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="0-1498711889-1184596010=:27236" X-Spam-Status: No, score=-4.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.1 X-Spam-Checker-Version: SpamAssassin 3.2.1 (2007-05-02) on mail.farley.org Cc: freebsd-hackers@FreeBSD.org Subject: Re: Setting up development environment X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Jul 2007 15:00:51 -0000 This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --0-1498711889-1184596010=:27236 Content-Type: TEXT/PLAIN; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE On Mon, 16 Jul 2007, Tom Evans wrote: > On Wed, 2007-05-30 at 08:21 +0200, Dag-Erling Sm=F8rgrav wrote: > ... >> Emacs setup (for both C and C++): >> >> (defun des-knf () >> (interactive) >> >> ;; Basic indent is 8 spaces >> (make-local-variable 'c-basic-offset) >> (setq c-basic-offset 8) >> >> ;; Continuation lines are indented 4 spaces >> (make-local-variable 'c-offsets-alist) >> (c-set-offset 'arglist-cont 4) >> (c-set-offset 'arglist-cont-nonempty 4) >> (c-set-offset 'statement-cont 4) >> >> ;; Labels are flush to the left >> (c-set-offset 'label [0]) >> >> ;; Fill column >> (make-local-variable 'fill-column) >> (setq fill-column 74)) >> >> (add-hook 'c-mode-common-hook 'des-knf) >> >> As for how to cross-build, read build(7). >> >> DES > > Before I start translating this/style(9), does anyone already have an > equivalent for vim? I have not made a proper indent file out of this, but this is what I use. Before I work on BSD code I just run :call FreeBSD_Style(). The IgnoreParenIndent() function is needed to avoid vim's built-in cindent code when it comes to line-continuation after a parentheses. Better solutions are welcome. --------------------------------------------- set nocompatible set autoindent " Let vim determine the file type to be edited. "filetype plugin indent on " Ignore indents caused by parentheses in FreeBSD style. fun! IgnoreParenIndent() =09let indent =3D cindent(v:lnum) =09if indent > 4000 =09=09if cindent(v:lnum - 1) > 4000 =09=09=09return indent(v:lnum - 1) =09=09else =09=09=09return indent(v:lnum - 1) + 4 =09=09endif =09else =09=09return (indent) =09endif endfun " Conform to style(9). fun! FreeBSD_Style() =09setlocal cindent =09setlocal formatoptions=3Dclnoqrt =09setlocal textwidth=3D80 =09setlocal indentexpr=3DIgnoreParenIndent() =09setlocal indentkeys=3D0{,0},0),:,0#,!^F,o,O,e =09setlocal cinoptions=3D(4200,u4200,+0.5s,*500,t0,U4200 =09setlocal shiftwidth=3D8 =09setlocal tabstop=3D8 =09setlocal noexpandtab endfun --------------------------------------------- Sean --=20 scf@FreeBSD.org --0-1498711889-1184596010=:27236--