From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: J Richardson Newsgroups: gmane.emacs.help Subject: Re: Java mode indention Date: 06 Aug 2003 14:21:46 -0400 Organization: IBM Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: References: <84brvaiq2i.fsf@slowfox.is.informatik.uni-duisburg.de> <2qlegb.5f.ln@acm.acm> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: main.gmane.org 1060194882 6422 80.91.224.253 (6 Aug 2003 18:34:42 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Wed, 6 Aug 2003 18:34:42 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Aug 06 20:35:04 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 19kT7o-0003a3-00 for ; Wed, 06 Aug 2003 20:35:04 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.20) id 19kT5Q-0006RD-KO for geh-help-gnu-emacs@m.gmane.org; Wed, 06 Aug 2003 14:32:36 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.20) id 19kT5D-0006Q5-G6 for help-gnu-emacs@gnu.org; Wed, 06 Aug 2003 14:32:23 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.20) id 19kT4h-0005wN-OB for help-gnu-emacs@gnu.org; Wed, 06 Aug 2003 14:32:22 -0400 Original-Received: from [80.91.224.249] (helo=main.gmane.org) by monty-python.gnu.org with esmtp (Exim 4.20) id 19kSw6-0002C2-G4 for help-gnu-emacs@gnu.org; Wed, 06 Aug 2003 14:22:58 -0400 Original-Received: from list by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 19kSvi-0001Am-00 for ; Wed, 06 Aug 2003 20:22:34 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-To: help-gnu-emacs@gnu.org Original-Received: from news by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 19kSvc-0001AZ-00 for ; Wed, 06 Aug 2003 20:22:28 +0200 Original-Lines: 81 Original-X-Complaints-To: usenet@main.gmane.org User-Agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/21.2 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:11624 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:11624 Alan Mackenzie writes: > J Richardson wrote on 31 Jul 2003 15:43:20 -0400: > > kai.grossjohann@gmx.net (Kai Großjohann) writes: > > >> J Richardson 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!