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: litchi
Subject: Re: how to change default indent style of java source files
Date: Tue, 26 Apr 2005 09:18:32 +0800
User-agent: Mutt/1.5.6+20040907i

On Mon, Apr 25, 2005 at 09:37:53AM -0600, Kevin Rodgers wrote:
> litchi wrote:
> > On Fri, Apr 22, 2005 at 12:36:34PM -0400, Greg Rowe wrote:
> >>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?
> >
> >
> > But it seems doesn't work on my system
> > when I press C-c following by .
> > emacs says C-c . is undefined
> > I guess C-c is a personal function prefix
> > so maybe you bonding your own function to C-c .
> 
> No, `C-c .' is bound to c-set-style in jde-mode.  In your Java buffer,
> what does `C-h v major-mode' display?
the output says my major-mode is java-mode
BTW: I solve this problem by put following in ~/.emacs

(defun my-java-mode-hook ()
   (c-set-style "k&r")
     (setq c-basic-offset 2))

  (add-hook 'java-mode-hook 'my-java-mode-hook)
but I dont know the meaning of those statements
I am totally a newer to lisp and emacs
> 
> -- 
> Kevin Rodgers
> 
> 
> 
> _______________________________________________
> Help-gnu-emacs mailing list
> Help-gnu-emacs@gnu.org
> http://lists.gnu.org/mailman/listinfo/help-gnu-emacs
Best regards
Litchi from China~~~

--
It takes a strong man to save himself, and a great man to save another.
IBM ThinkPad T23 hiweed0.6
fetchmail+procmail+mutt+msmtp vim7+emacs22+mule




reply via email to

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