I figured out how to make continuation lines indent by only 4 spaces.
Three lines from my previous posting must be changed.  See below:

Tom Whitten writes:
        [SNIP]
> 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'.
> 

To get continuation lines to indent by 4 spaces, change the "+" in the
following function to 4.

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

Reply via email to