* Re: how to change default indent style of java source files
[not found] <mailman.2548.1114155862.2895.help-gnu-emacs@gnu.org>
@ 2005-04-22 16:36 ` Greg Rowe
2005-04-23 1:24 ` litchi
0 siblings, 1 reply; 6+ messages in thread
From: Greg Rowe @ 2005-04-22 16:36 UTC (permalink / raw)
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.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: how to change default indent style of java source files
2005-04-22 16:36 ` how to change default indent style of java source files Greg Rowe
@ 2005-04-23 1:24 ` litchi
2005-04-25 15:37 ` Kevin Rodgers
0 siblings, 1 reply; 6+ messages in thread
From: litchi @ 2005-04-23 1:24 UTC (permalink / raw)
On Fri, Apr 22, 2005 at 12:36:34PM -0400, Greg Rowe wrote:
> 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
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 .
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: how to change default indent style of java source files
2005-04-23 1:24 ` litchi
@ 2005-04-25 15:37 ` Kevin Rodgers
2005-04-26 1:18 ` litchi
[not found] ` <mailman.2987.1114478437.2895.help-gnu-emacs@gnu.org>
0 siblings, 2 replies; 6+ messages in thread
From: Kevin Rodgers @ 2005-04-25 15:37 UTC (permalink / raw)
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?
--
Kevin Rodgers
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: how to change default indent style of java source files
2005-04-25 15:37 ` Kevin Rodgers
@ 2005-04-26 1:18 ` litchi
[not found] ` <mailman.2987.1114478437.2895.help-gnu-emacs@gnu.org>
1 sibling, 0 replies; 6+ messages in thread
From: litchi @ 2005-04-26 1:18 UTC (permalink / raw)
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: how to change default indent style of java source files
[not found] ` <mailman.2987.1114478437.2895.help-gnu-emacs@gnu.org>
@ 2005-04-26 12:02 ` Greg Rowe
2005-04-27 1:31 ` litchi
0 siblings, 1 reply; 6+ messages in thread
From: Greg Rowe @ 2005-04-26 12:02 UTC (permalink / raw)
litchi wrote:
>
> (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
You defined function called 'my-java-mode-hook'. In that function you
made a couple calls to customize the current buffer. When you call
add-hook you are adding your customization function to a list of
functions that will be called any time that java-mode is started.
Greg
--
Home is where the .bashrc is.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: how to change default indent style of java source files
2005-04-26 12:02 ` Greg Rowe
@ 2005-04-27 1:31 ` litchi
0 siblings, 0 replies; 6+ messages in thread
From: litchi @ 2005-04-27 1:31 UTC (permalink / raw)
On Tue, Apr 26, 2005 at 08:02:23AM -0400, Greg Rowe wrote:
> litchi wrote:
> >
> >(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
>
> You defined function called 'my-java-mode-hook'. In that function you
> made a couple calls to customize the current buffer. When you call
> add-hook you are adding your customization function to a list of
> functions that will be called any time that java-mode is started.
I have read the part in Emacs manual of indent and customization the
style,knon something aboule customization the style,
but now I have another question,
suppose a block,default indent style is just as follow, how can I
make The indent of all level statements and methods the same,but
not let the first level twice the indent of others.
public class A
{
~~~~4 backspace ---> how to change this 4 space to 2 space also?
(suppose 2 space is the default offset)
public A()
{
~~2 backspace
if(a)
{
~~2 backspace also
then;
}
}
}
>
> Greg
>
> --
> Home is where the .bashrc is.
> _______________________________________________
> 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
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2005-04-27 1:31 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <mailman.2548.1114155862.2895.help-gnu-emacs@gnu.org>
2005-04-22 16:36 ` how to change default indent style of java source files Greg Rowe
2005-04-23 1:24 ` litchi
2005-04-25 15:37 ` Kevin Rodgers
2005-04-26 1:18 ` litchi
[not found] ` <mailman.2987.1114478437.2895.help-gnu-emacs@gnu.org>
2005-04-26 12:02 ` Greg Rowe
2005-04-27 1:31 ` litchi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).