I think you want to use : (c-set-offset 'substatement-open 0)

I have a java mode hook that calls this for me.




                                                                                       
                                                        
                    James Cox                                                          
                                                        
                    <[EMAIL PROTECTED]       To:     "'Jeffrey Smith'" <[EMAIL PROTECTED]>, 
[EMAIL PROTECTED]                                           
                    om>                  cc:                                           
                                                        
                                         Subject:     RE: indentation question         
                                                        
                    04/17/02 03:08                                                     
                                                        
                    PM                                                                 
                                                        
                                                                                       
                                                        
                                                                                       
                                                        




I use the same indentation style that you do, but I set it in a different
manner in my dot-emacs.  (I believe that i ripped it from the FAQ).  If you
want to monkey around with what you have, this may help, it's the value of
my c-offsets-alist.  You're probably not setting something (defun-open &
close maybe?)

hope this helps.

((string . c-lineup-dont-change)
 (c . c-lineup-C-comments)
 (defun-open . 0)
 (defun-close . 0)
 (defun-block-intro . +)
 (class-open . 0)
 (class-close . 0)
 (inline-close . 0)
 (knr-argdecl . 0)
 (topmost-intro . 0)
 (member-init-intro . +)
 (member-init-cont . c-lineup-multi-inher)
 (inher-intro . +)
 (block-open . 0)
 (block-close . 0)
 (brace-list-open . 0)
 (brace-list-close . 0)
 (brace-list-intro . +)
 (brace-list-entry . 0)
 (brace-entry-open . 0)
 (statement . 0)
 (statement-case-intro . +)
 (substatement . +)
 (case-label . +)
 (do-while-closure . 0)
 (else-clause . 0)
 (catch-clause . 0)
 (comment-intro . c-lineup-comment)
 (arglist-cont . 0)
 (arglist-cont-nonempty . c-lineup-arglist)
 (stream-op . c-lineup-streamop)
 (inclass . +)
 (cpp-macro .
               [0])
 (cpp-macro-cont . c-lineup-dont-change)
 (friend . 0)
 (objc-method-intro .
                         [0])
 (objc-method-args-cont . c-lineup-ObjC-method-args)
 (objc-method-call-cont . c-lineup-ObjC-method-call)
 (extern-lang-open . 0)
 (extern-lang-close . 0)
 (inextern-lang . +)
 (namespace-open . 0)
 (namespace-close . 0)
 (innamespace . +)
 (template-args-cont c-lineup-template-args +)
 (inlambda . c-lineup-inexpr-block)
 (lambda-intro-cont . +)
 (inexpr-statement . 0)
 (inexpr-class . +)
 (inline-open . 0)
 (topmost-intro-cont . +)
 (statement-block-intro . +)
 (knr-argdecl-intro . 5)
 (substatement-open . 0)
 (label . +)
 (statement-case-open . 0)
 (statement-cont . +)
 (arglist-intro . c-lineup-arglist-intro-after-paren)
 (arglist-close . c-lineup-arglist)
 (access-label . 0)
 (inher-cont . c-lineup-java-inher)
 (func-decl-cont . c-lineup-java-throws))



> -----Original Message-----
> From: Jeffrey Smith [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, April 17, 2002 2:45 PM
> To: [EMAIL PROTECTED]
> Subject: indentation question
>
>
> I realize that it is actually cc-mode that handles
> indentation, but I'm
> hoping someone here can help me even though this is slightly off
> topic.  Since upgrading to emacs 21.1, braces on the line
> after an "if",
> "else", "try", or "catch" are now indented:
>
> desired way(worked with emacs 20.7.1)
> if ( foo )
> {
>      blah();
> }
>
> new way
> if ( foo )
>      {
>          blah();
>      }
>
> I've been playing around with my java-style all morning, but
> I just can't
> get it to work.  Here is my style:
>
> (defconst av-java-style
>    '((c-basic-offset . 4)
>      (c-comment-only-line-offset 0 . 0)
>      (c-offsets-alist
>       (inline-open . 0)
>       (statement-block-intro . +)
>       (block-open . -)
>       (topmost-intro-cont . +)
>       (knr-argdecl-intro . +)
>       (substatement-open . 0)
>       (case-label . 2)
>       (statement-case-intro . 2)
>       (label . 0)
>       (statement-case-open . +)
>       (statement-cont . +)
>       (arglist-intro . +)
>       (arglist-close . c-lineup-arglist)
>       (access-label . 0)))
>    "My Java style, according to the My Java style guide.")
>
>
> ---------------------------
> Jeff Smith
> [EMAIL PROTECTED]
> BEA Systems, Inc.
> ---------------------------
>





Reply via email to