You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by Daniel Rall <dl...@collab.net> on 2003/01/15 00:39:01 UTC

Re: apache-java mode for emacs

On Mon, 13 Jan 2003, Henning P. Schmiedehausen wrote:

> Cool, that was my bad, but before my next M-x indent-region reformats
> this and it pops out again: Does anyone know what to change in the
> "official apache-java indentiation elisp for emacs" that keeps line
> continuations not below the preceeding line but just four spaces
> indented?
> 
> I'd be really grateful for this. ATM I use
> 
> (defconst apache-java-style
>   '((c-basic-offset . 4)
>     (c-comment-only-line-offset 0 . 0)
>     (indent-tabs-mode             . nil)
>     (c-offsets-alist
>      (inline-open . 0)
>      (topmost-intro-cont . +)
>      (statement-block-intro . +)
>      (knr-argdecl-intro . +)
>      (substatement-open 0 nil)
>      (label . +)
>      (statement-case-open . +)
>      (statement-cont . +)
>      (arglist-intro . +)
>      (arglist-cont . 0)
>      (arglist-cont-nonempty . c-lineup-arglist)
>      (arglist-close . c-lineup-arglist)
>      (access-label . 0)
>      (inher-cont . c-lineup-java-inher)
>      (func-decl-cont . c-lineup-java-throws)))
>     "apache-java"
>     )

The offset attribute that you want to adjust is arglist-cont-nonempty.  I
prefer the default of c-lineup-arglist (which is basically a function
pointer to a defun from cc-align.el), but you'd like to set that to 4.

I was able to guess that from examining the above and comparing it to the
source of cc-vars.el, but there's a better way.  Consider the code below:

myFancyFunction("a big long argument which is going to make me insert a " +
                "string concatenation ... hopefully javac is smart");

Position your cursor at the beginning of the second line, on or near the
word "string".  Invoke the interactive function c-set-offset by typing M-x,
then c-set-offset, and hitting return.  You'll be prompted for the "Synatic
symbol to change", with Emacs' best guess filled in.  Following the above
instructions, that should be arglist-cont-nonempty.  If so, hit enter.  If
not, delete what Emacs filled in for ya and press tab twice to see the list
of possible completions.  After selecting arglist-cont-nonempty, you'll be
prompted for the offset you'd like.  AFAICT, this can be any real number, a
symbol (which could be a variable, function pointer, etc.), or the "+"  
character for your default offset (c-basic-offset, which I usually set to
4).  Sounds like you want to use c-basic-offset here, which you can type in
directly (without completion) or use the special + character for (this is
what I would do).

> But I've successfully avoided to become too familiar with (e)lisp. I
> noted that everyone who did sooner or later went insane... :-)

Is that what happened to me...?  ;P

- Dan




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: apache-java mode for emacs

Posted by Kurt Schrader <ks...@karmalab.org>.
On Tue, 14 Jan 2003, Daniel Rall wrote:

> On Mon, 13 Jan 2003, Henning P. Schmiedehausen wrote:
>
> > But I've successfully avoided to become too familiar with (e)lisp. I
> > noted that everyone who did sooner or later went insane... :-)
>
> Is that what happened to me...?  ;P

Clearly +1  :-)

-Kurt


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>