tags:

views:

135

answers:

1

In my .emacs file, I have a c-common-mode-hook that sets c-basic-offset to 4, but whenever I create a java file this is reset to 2. How do I set indentation to four spaces in JDE mode?

+2  A: 

Well, worst case, you customize java-mode via a hook:

(defun my-java-mode-setup ()
  "force c-basic-offset to be 4"
  (setq c-basic-offset 4))
(add-hook 'java-mode-hook 'my-java-mode-setup)

Debugging why your basic hook setting doesn't stick will require more information than you've given us. I'm doing what you describe and see the offset to be 4 in java files. It could be that you're using a built-in style that sets the offset to 2 after your common hook. See this documentation for how to customize styles.

Trey Jackson