I think what you're asking for is that the "{" not be indented 2.
If so here is what I have in my .emacs  to accomplish this:

(defun my-java-mode-hook()
  "Hook for running Java file..."
  (message "Loading my-java-hook...")
   ;;don't indent braces
  (c-set-offset 'substatement-open 0))

(add-hook 'java-mode-hook     'my-java-mode-hook)

Hope this helps.

Willi Richert wrote:

> I am not able to set substatement-open in .emacs so that I get
> if (asdf=12)
> {
> }
> without the offset 2.
> Although if I change it with C-c C-o  (curser before the opening brace)
> it works correctly.
> How do I change my .emacs file so that I don't have to modify it every
> run?
> Replacing (substatement-open before after) with (substatement-open 0)
> didn't work either.
>
> (add-hook 'jde-mode-hook 'my-jde-mode-hook)
> (defun my-jde-mode-hook ()
>   (imenu-add-to-menubar "Find")
>   (c-add-style
>     "my-java"
>     '("java"
>      (c-basic-offset . 2)
>      (c-hanging-braces-alist . ((substatement-open before after)))
>    ))
> ....
>
> willi


begin:          vcard
fn:             Rich Johns
n:              Johns;Rich
org:            Trajecta
email;internet: [EMAIL PROTECTED]
title:          Software Designer
note:           [EMAIL PROTECTED]
x-mozilla-cpt:  ;0
x-mozilla-html: TRUE
version:        2.1
end:            vcard

Reply via email to