(add-hook 'java-mode-hook (lambda () (setq tab-width 8)))
(add-hook 'java-mode-hook (lambda () (setq c-basic-offset 8)))
is perhaps you answer.
add this lines to your ~/.emacs
Hope this help
(i am new to emacs too, so that 's a guess :) )
Bye ,
Steff
Rich Johns wrote:
> Thanks Steve. I've tried to use this on files that were originally
> written with the tab==spaces approach, but it doesn't seem to
> convert all the spaces to tabs. I can understand why, becuase
> there would be places where you really wanted spaces. I guess
> what I would want is just the indention spaces changed. Not sure
> if that is possible.
>
> The other thing that plagues me is not being able to hit tab
> 2 times to get an indention of 8. For example, some people
> on my team like 8 space indent, so when I go into their code
> and try to honor their indention scheme, I have to use 1 tab and
> 4 spaces.
>
> void foo() {
> int i = 0; // this is where the original author goes with tabs.
> int x = 1; // this is where I can go with a tab
> }
>
> Is this due to the syntax intelligent indention via cc-mode? Actually
> I'm using jde mode which I believe totally relies on cc-mode.
>
> I really prefer spaces because I think it is ultimately the answer to
> indention harmony within a development group. But, the rule in this
> group is tabs. I'll get used to ....
>
> thanks
>
> Steve Haflich wrote:
>
> > The key is M-x untabify. You can invoke this automatically with
> > something like te following untested form in your ~/.emacs
> >
> > (add-hook java-mode
> > (function (lambda ()
> > (add-hook 'local-write-file-hooks
> > (function (lambda ()
> > (save-excursion
> > (widen)
> > (untabify (point-min) (point-max)))))))))
> >
> > This is a good way to install other mode-specific source normalization
> > hooks. For instance, I always delete trailing whitespace in my source
> > buffers. This greatly reduces the noise merge diff output during
> > cooperative development.
> >
> > Remember, this will munge your code in ways you dno't expect if you
> > have literal tab chars inside literal strings.