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

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

Re: Java mode indention


From: J Richardson
Subject: Re: Java mode indention
Date: 06 Aug 2003 14:21:46 -0400
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/21.2

Alan Mackenzie<none@example.invalid> writes:

> J Richardson <jrivers77@yahoo.com> wrote on 31 Jul 2003 15:43:20 -0400:
> > kai.grossjohann@gmx.net (Kai Großjohann) writes:
> 
> >> J Richardson <jrivers77@yahoo.com> writes:
> 
> [ .... ]
> 
> >> I did it my running (c-set-offset 'arglist-intro '+) from
> >> java-mode-hook:
> 
> >> (defun my-java-indent ()
> >>   (c-set-offset ...))
> >> (add-hook 'java-mode-hook 'my-java-indent)
> 
> > I have that... it only works for one set of parentheses though. I don't
> > like what it does if you add another one. I'm not sure what terminology
> > to use. It goes from the start of the method call instead of the start
> > of the whole statement.
> 
> > My offset is set to 4, and I have (c-set-offset 'arglist-intro '+), so:
> 
> >   a_method(another_method(foo,
> >                bar));
> 
> >           ^ it adds the extra offset of 4 from here
> 
> Are you being absolutely accurate here?  "bar" seems to be indented _5_
> columns from the "(" and _13_ columns from beginning-of-line.  Could you
> do a C-c C-s (i.e. `c-show-syntactic-information') on this line, please?
> 

Sorry, two things here. The ^ actually should be one more space to the
right, and I was thinking about my other example. It's
arglist-cont-nonempty in this case. It's set to + too.

  arglist-intro:
  a_method(another_method(
               foo, bar));


  arglist-cont-nonempty:
  a_method(another_method(foo,
               bar));

> Also, which version of CC Mode are you using?  (Do M-x c-version).

CC Mode version 5.28

> 
> > when I'd prefer this:
> 
> >   a_method(another_method(foo,
> >       bar));
> 
> >   ^ I want it to add it from here
> 
> In the most recent CC Mode (5.30) it looks like the "bar" would get
> indented 8 columns from begining-of-line (4 columns (c-basic-offset) for
> each level of parentheses).  This isn't very good either.  It may well be
> that the best quick fix would be to write you a special indentation
> function (see the page "Indentation Functions" in the CC Mode manual).

I'll check out 5.30. Indenting from the beginning of the line is the
issue I wasn't sure how to work around.

I looked at indentation functions a while ago. Rechecking now, they
take a syntactic component cons cell which contains the "buffer
relative position" and return the offset to add to that position. I'm
by no means an elisp guru, so I may be missing something, but since
it's the buffer relative position that I don't like I'm not sure how
to get that to work. It sounds like CC Mode 5.30 may help there
though.

> 
> The most helpful place to report this sort of problem is on the CC Mode
> mailing list at bug-cc-mode@gnu.org.
> 

Thanks!





reply via email to

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