I grappled with this same problem some time ago, the following jde-mode-hook
fixed it for me, and avoided deriving my own style from "java", which I couldn't
get to work :
(defun my-jde-mode-hook ()
(setq c-basic-offset 4)
(c-set-offset 'substatement-open 0) ; this is the one you care about
(c-set-offset 'statement-case-open 0)
(c-set-offset 'case-label '+)
(setq tab-width 4
;; make sure spaces are used instead of tabs
indent-tabs-mode nil)
(message "my-jde-mode-hook function executed"))
(add-hook 'jde-mode-hook 'my-jde-mode-hook)
David Waite wrote:
> I am sorry, I have looked through all of the JDE manuals, the faq on the
> site, the www.emacs.org site and even went on irc to see if someone could
> help, and have hacked all day. I am trying to get the indentation for
>
> if (i)
> {
> ....
> }
>
> to be
>
> if (i)
> {
> ....
> }
>
> I gathered I do this by changing substatement-open to 0 (from +). But my
> lack of experience with elisp gets me here.
>
> below are the relevant bits of my .emacs: (only cut out color-setting code).
> Any idea what I am doing wrong?
>
> -David Waite
>
> ====== .emacs ======
>
> (custom-set-faces
> '(show-paren-mismatch-face ((((class color)) (:foreground "black"
> :background "red2"))))
> '(show-paren-match-face ((((class color)) (:foreground "black" :background
> "green3")))))
>
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> ;; Highlighting.
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>
> (transient-mark-mode t)
>
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> ;; Paren matching
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>
> (require 'paren)
> (show-paren-mode 1)
> (custom-set-faces
> '(show-paren-match-face ((((class color))
> (:foreground "black" :background "green3"))))
> '(show-paren-mismatch-face ((((class color))
> (:foreground "black" :background "red2")))))
>
> (defun my-jde-mode-hook ()
> (c-add-style
> "my-java"
> '("java"
> (substatement-open . 0)))
> (c-set-style "my-java"))
>
> (add-hook 'jde-mode-hook 'my-jde-mode-hook)
>
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> ;; For JDE
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> l
>
> (setq load-path
> (nconc
>
> "c:/devel/jde-2.1.6beta10/lisp"
> )
> load-path))
> (require 'jde)
>
> ====== end ======