0

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?

Nathaniel Flath
  • 15,477
  • 19
  • 69
  • 94

1 Answers1

2

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
  • 73,529
  • 11
  • 197
  • 229