Gary Mills writes: > > Could you please make sure the code conforms with > > cstyle as defined in > > > > http://opensolaris.org/os/community/documentation/gett > > ing_started_docs/cstyle.ms.pdf > > [snip] > Wow, that was painful with emacs, but it now passes `cstyle -pPc'. > I suppose I'll have to change my emacs macros that I haven't > touched in years.
Gary, Below you'll find the C stuff that I use in my .emacs file. The one thing that I know that it does not do correctly is to only indent continuation lines by 4 spaces. If you ever figure out the solution for this or have any other improvements, I'd be happy to hear your suggestions. tom ============================== (defun all-c-stuff() "Do all things for c-mode-hook" (interactive) (sun-cstyle-std) (sun-c-std) (turn-on-font-lock) ) ;;; Define a C style for use at Sun Microsystems: ;;; Courtesy of Jim Xenidis and Matt Simmons'. (defun sun-cstyle-std() "Define a coding style that understands Sun's cstyle." (c-add-style "sun" '((c-basic-offset . 8) (ispell-check-comments . exclusive) (c-label-minimum-indentation . 0) (inextern-lang . 0) (c-offsets-alist (arglist-cont . +) (arglist-cont-nonempty . +) (label . 0) (statement-cont . +) (label . -1000))) t) ) ;;; Set variables for Sun C coding style. (defun sun-c-std() (setq fill-column 80) ;; line length is 80 col. (c-set-style "sun") ;; Use Sun's style (setq c-basic-offset 8) ;; set indent width to 8 (setq c-comment-only-line-offset '(0 . 0)) ;; don't indent comments (setq c-tab-always-indent nil) ;; Allow insert of tabs within code (setq c-hanging-comment-ender-p nil) ;; comment ends on own line (setq c-hanging-comment-starter-p nil);; comment starts on own line ) (add-hook 'c-mode-hook 'all-c-stuff)