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

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

cc-mode indentation questions


From: Erik Osheim
Subject: cc-mode indentation questions
Date: Wed, 24 Aug 2005 13:13:28 -0400

Hello,

I'm struggling with configuring emacs to indent perl code according to
the coding standards at my job. I had been trying to set the
indentation variables and recently found the CC mode manual which
makes it clear that I will probably have to write my own indentation
methods.

I'm not especially good at ELisp, and I'm not an ELisp hacker, so I'd
like some guidance before I embark on this. I'm working with the CPerl
module, which has some problems but is pretty good (and is light years
ahead of the basic perl-mode).

NOTE-- I am not saying that I like these indentation methods, but they
are the ones everyone else has agreed on so I need to try to use them.

I'd like indented code to look like this:

$a = some_method_name(
    $a,
    $b,
);
another_method_that_takes_a_hash
(
    'foo' => 'bar',
    'black' => 'white',
);


Whereas currently those indent like this:

$a = some_method_name(
                      $a,
                      $b
                     );
another_method_that takes_a_hash
    (
     'foo' => 'bar',
     'black' => 'white',
    );


As I understand it, when I hit TAB on each line, emacs figures out
what to tag that line as (i.e. "arglist-cont-nonempty") and then calls
the appropriate indentation function. If I can figure out which tags
these lines have, I can start experimenting with using various methods
to try to get them to behave properly.

Things I'd like to find out include:

1. Has someone else already done this?
2. How are these examples tagged by the lexer?
3. Which indentation methods get called on each line? 

I have been using the CC Manual's section on advanced indentation
(http://www.delorie.com/gnu/docs/emacs/cc-mode_33.html) but I am
mostly lost and not really sure how these lines are being
handled. Furthermore since I'm not very good at ELisp I have not had
much luck writing methods to determine which parts are getting called
where.

Any input would be appreciated. Please cc: me in any reply since I'm
not currently subscribed to this list. Also, if there is a more
appropriate place to post this, let me know.

Thanks,

-- Erik





reply via email to

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