From owner-p4-projects@FreeBSD.ORG Sat Oct 20 02:37:03 2007 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id A110016A419; Sat, 20 Oct 2007 02:37:03 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 318C216A417; Sat, 20 Oct 2007 02:37:03 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id B620413C457; Sat, 20 Oct 2007 02:37:02 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.1/8.14.1) with ESMTP id l9K2Youx038770; Fri, 19 Oct 2007 20:34:50 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Fri, 19 Oct 2007 20:36:30 -0600 (MDT) Message-Id: <20071019.203630.-231515490.imp@bsdimp.com> To: jhb@freebsd.org From: "M. Warner Losh" In-Reply-To: <200710170844.47761.jhb@freebsd.org> References: <20071016043133.GW31826@elvis.mu.org> <200710161823.59940.hselasky@freebsd.org> <200710170844.47761.jhb@freebsd.org> X-Mailer: Mew version 5.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: alfred@freebsd.org, perforce@freebsd.org, hselasky@freebsd.org, cnst@freebsd.org Subject: Re: PERFORCE change 126745 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Oct 2007 02:37:03 -0000 In message: <200710170844.47761.jhb@freebsd.org> John Baldwin writes: : On Tuesday 16 October 2007 12:23:59 pm Hans Petter Selasky wrote: : > On Tuesday 16 October 2007, Alfred Perlstein wrote: : > > * Hans Petter Selasky [070923 13:13] wrote: : > > > Hi Constantine, : > > > : > > > Thanks for your input and I _know_ that my code is not 100% style : > > > compliant. Most of the style misbehaves are probably there due to the way : > > > my "xemacs" autoformatting behaves. And I love curly brackets and : > > > parenthesis, by the way :-) : > > > : > > > My plan is to clean up all the style stuff by a small C-program in the : > > > end, because doing it by hand is waste of my time. Probably it will take : > > > less time to write that program than the actual manual edit when we are : > > > talking about doing alot of edits. It wonders me if such a tool already : > > > exists, because the code is technically OK. : > > > : > > > Anyone that wants to be a little more constructive and point towards : > > > where the FreeBSD style transformer program is? I assume it would be : > > > extremely useful to everyone that is forced to use multiple different : > > > styles depending on what project they are contributing to, like me. Then : > > > before commit I will run that script and verify the differences. And : > > > that's it. : > > > : > > > --HPS : > > : > > Hans, one of the issues with doing such changes at the end is that it : > > effectively obliterates the ability to "cvs annotate" your code. I'm : > > sure perforce has an 'annotate' command as well. : > > : > > I would suggest that you find/fix the style now and apply it now rather : > > than later as the longer you wait, the more history you obliterate. : > : > Hi Alfred, : > : > I never heard about the annotate command. Can you explain a little bit how it : > works? : > : > I will do as you want and write that "style converter" first, before any other : > changes. I expect it might take a little bit time, something like a week. : : FWIW, p4 does have an annotate via the p4web interface. Also, there are .emacs : snippets that (mostly) do style(9). The only thing I know of that they don't : quite get right is continuation of nested conditions in a control statement such : as the following: : : if (foo && bar(baz, : qux)) : : Emacs will render this as : : if (foo && bar(baz, : qux)) : : by default, so I end up manually fixing those up. (add-hook 'c-mode-common-hook 'imp-simple-c-mode-setup t) (defun imp-simple-c-mode-setup () "simple" (setq c-conditional-key c-C++-conditional-key) (setq c-tab-always-indent nil) (c-toggle-auto-state 1)) (defconst knf-c-style '((c-basic-offset . 8) (c-comment-only-line-offset . 0) (c-offsets-alist . ((statement-block-intro . +) (knr-argdecl-intro . +) (substatement-open . 0) (label . 0) (statement-cont . +) (inline-open . 0) (inexpr-class . 0) (statement-cont . *) (arglist-cont . *) (arglist-cont-nonempty *)))) "BSD KNF") (c-add-style "knf" knf-c-style) (custom-set-variables ;; custom-set-variables was added by Custom -- don't edit or cut/paste it! ;; Your init file should contain only one such instance. '(c-default-style "knf"))