help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how to change default indent style of java source files


From: Greg Rowe
Subject: Re: how to change default indent style of java source files
Date: Fri, 22 Apr 2005 12:36:34 -0400
User-agent: Mozilla Thunderbird 1.0 (Windows/20041206)

litchi wrote:

a question is the indent style of emacs default is just like
public void helloWorld()
{
  if(today.weather == find)
    {
      System.out.println("oh~ a fine day~");
    }
}
but actually the style I expect is public void helloWorld()
{
  if(today.weather == find)
  {
    System.out.println("oh~ a fine day~");
  }
}

That's odd. The default coding style when I'm in java mode in emacs is the 'java' coding style which matches the style you are looking for.

Anyhow, to change your coding style you can execute "C-c ." while emacs is running. Hit TAB to view a list of styles. When you find the one you want put the following in your .emacs:

(add-hook 'java-mode (lambda ()
        (c-set-style "java"))

Of course, replace "java" with the style you like best.

But, if you are in java mode then your default style ought to be what you desire anyhow. Are you sure you don't have a mismatched paren or brace that might trip up the indentation scheme?

Greg

--
Home is where the .bashrc is.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]